This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Description: http://daringfireball.net/2010/08/open_urls_in_safari_tabs | |
# License: See below. | |
# http://gist.github.com/507356 | |
use strict; | |
use warnings; | |
use URI::Escape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class PaddedStringFormatInfo : IFormatProvider, ICustomFormatter { | |
public object GetFormat(Type formatType) | |
{ | |
if (typeof(ICustomFormatter).Equals(formatType)) return this; | |
return null; | |
} | |
public string Format(string format, object arg, IFormatProvider formatProvider) | |
{ | |
if (arg == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, sqlite3, tempfile, subprocess, os | |
def do_select(connection, table, fields): | |
connection.row_factory = sqlite3.Row | |
c = connection.cursor() | |
# If no fields are given, use all fields | |
if fields == []: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Plant rope vim's plugin | |
# This is a script to install or update 'ropevim' | |
# Copyright Alexander Artemenko, 2008 | |
# Contact me at svetlyak.40wt at gmail com | |
function create_dirs | |
{ | |
mkdir -p src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eg. to print the ids of all documents within a couchdb database: | |
curl "http://127.0.0.1:5984/somedb/_all_docs" | jsoneval.js "body.rows.forEach( function( r ){ console.info( r.id ) } );" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<!-- This should be the simplest possible jQuery based CouchApp. Install by uploading to a design document in Futon or putting in _attachments/index.html and running `couchapp push` --> | |
<head><title>Tiny CouchApp</title></head> | |
<body> | |
<h1>Tiny CouchApp</h1> | |
<ul id="databases"></ul> | |
</body> | |
<script src="/_utils/script/jquery.js"></script> | |
<script src="/_utils/script/jquery.couch.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
au BufNewFile,BufRead *.js set makeprg=gjslint\ % | |
" The ^G at the end is an actual <Ctrl-G> char. | |
" Gist won't let me include it, so you'll have to delete the last two characters | |
" and insert it yourself with <Ctrl-V><Ctrl-G> | |
au BufNewFile,BufRead *.js set errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyle%s,%-Gscript\ can\ %s,%-G^G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on | |
# http://japskua.wordpress.com/2010/08/04/detecting-eyes-with-python-opencv/ | |
# http://stackoverflow.com/questions/1650568/how-do-i-create-an-opencv-image-from-a-pil-image | |
import os | |
import sys | |
import logging | |
from cStringIO import StringIO | |
import cv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write com.twitter.twitter-mac UserTimelineDerepeater -bool true | |
defaults write com.twitter.twitter-mac ScrollingMakesKeyAndOrdersFront -bool true | |
defaults write com.twitter.twitter-mac TypeAnywhereToTweet -bool true | |
defaults write com.twitter.twitter-mac HideInBackground -bool true | |
defaults write com.twitter.twitter-mac NormalComposeWindowLevel -bool false | |
defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true |
OlderNewer