Skip to content

Instantly share code, notes, and snippets.

@mhafalir
mhafalir / git-branch-status.sh
Created November 19, 2015 13:38
git branch status
#!/bin/bash
# by http://github.com/jehiah
# this prints out some branch status (similar to the '... ahead' info you get from git status)
# example:
# $ git branch-status
# dns_check (ahead 1) | (behind 112) origin/master
# master (ahead 2) | (behind 0) origin/master
COLOR_RED="\033[0;31m"
@mhafalir
mhafalir / YoutubePlaylistsBackup.js
Created December 15, 2014 22:47
YoutubePlaylistsBackup
function backupYoutubeListsV2(){
Logger.log('Processing your request: backupYoutubeListsV2');
var driveFile, docFile, lastBackupJson;
var driveFiles = Drive.Files.list().items;
for(var i = 0; i < driveFiles.length; i++){
var title = driveFiles[i].title;
if(title == "YoutubeListsBackup"){
driveFile = driveFiles[i];
break;
@mhafalir
mhafalir / toolkit
Created December 14, 2014 02:28
Find DateTime Gaps
using System;
using System.Collections.Generic;
using System.Linq;
class Toolkit
{
public class DateTimeInterval
{
public DateTime BeginDate { get; set; }
public DateTime EndDate { get; set; }
@mhafalir
mhafalir / blur-switch.js
Last active August 29, 2015 14:01
Blur Switch
var blurit = blured == undefined || blured == false;
var blured = blurit;
if(blurInterval){
clearInterval(blurInterval);
}
function blurSwitch(){
var service = '';
var def = [
{ host: 'mail.google.com', selectors: [{ selector: 'div.yW,div.xT,span.y2,div.av,div.aKs', hshadow: '0', vshadow: '0', blur: '12px', color: '#000000' }] },
{ host: 'trello.com', selectors: [{ selector: '.list-card-title.clear,h3', hshadow: '0', vshadow: '0', blur: '12px', color: '#000000' }, { selector: '.board-list-item-name,.board-list-item-sub-name', hshadow: '0', vshadow: '0', blur: '12px', color: '#ffffff' }] },
@mhafalir
mhafalir / ExecutionTimeLogger.cs
Created April 16, 2012 11:27
ExecutionTimeLogger
public class ExecutionTimeLogger : IDisposable
{
public DateTime BeginTime { get; set; }
public DateTime EndTime { get; set; }
public double TotalMilliseconds { get; set; }
public string Data { get; set; }
public ExecutionTimeLogger(string data = "")
{
this.BeginTime = DateTime.Now;
@mhafalir
mhafalir / MongoDataProvider.cs
Created April 11, 2012 20:37
MongoDB-Repository-Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
public class MongoObject
{