Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mikeyk's full-sized avatar

Mike Krieger mikeyk

  • San Francisco, CA
View GitHub Profile
// first use the jQuerify plugin here: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
$jq("tbody tr", $("#fs-0")).each(function(index, el){
var nameTD = $jq("td.name", el);
var nameSpan = $jq("span", nameTD);
var name = nameSpan.attr("title") ? nameSpan.attr("title") : nameSpan.text();
var deviceID = $jq("td.id", el).attr("title");
console.log(name + '\t' + deviceID);
})
// placed in my applicationDidFinishLaunchingWithOptions
if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
/home/ubuntu/src/redis/redis/client.py in _execute_command
return self.parse_response(command_name, **options) ...
▼ Local vars
Variable Value
self
u'<redis.client.Redis object at 0xabbb02c>'
@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
set nocompatible
set autoindent
set si
set smartindent
set esckeys
" set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws
set magic
==> Downloading http://download.osgeo.org/geos/geos-3.3.0.tar.bz2
File already downloaded in /Users/mkrieger/Library/Caches/Homebrew
/usr/bin/tar xf /Users/mkrieger/Library/Caches/Homebrew/geos-3.3.0.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
./configure --prefix=/usr/local/Cellar/geos/3.3.0 --disable-debug --disable-dependency-tracking
configure: WARNING: unrecognized options: --disable-debug
checking build system type... i386-apple-darwin11.0.0
checking host system type... i386-apple-darwin11.0.0
checking target system type... i386-apple-darwin11.0.0
@mikeyk
mikeyk / reconnect.diff
Created June 30, 2011 21:05
Automatically retry on AutoReconnect exception in pymongo
diff --git a/pymongo/connection.py b/pymongo/connection.py
index b444f50..7635c78 100644
--- a/pymongo/connection.py
+++ b/pymongo/connection.py
@@ -46,6 +46,7 @@ from pymongo import (database,
helpers,
message)
from pymongo.cursor_manager import CursorManager
+from pymongo.decorators import reconnect
from pymongo.errors import (AutoReconnect,
@mikeyk
mikeyk / (deprecated)UINotificationKeyboardHeight.m
Created September 8, 2011 23:31
Get keyboard height from an NSNotification
@implementation NSNotification (KeyboardHeight)
- (CGFloat)keyboardHeight {
CGRect bounds;
NSValue *boundsValue = [self.userInfo objectForKey:UIKeyboardBoundsUserInfoKey];
if (boundsValue) {
[boundsValue getValue:&bounds];
return bounds.size.height;
} else {
return 0;
@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])