Skip to content

Instantly share code, notes, and snippets.

View darrylhebbes's full-sized avatar

Darryl Hebbes darrylhebbes

  • Berlin, Germany
View GitHub Profile
innerWidth / innerHeight tests @ http://sandbox.thewikies.com/orientation/
--------------------------------------------------------------------------------
Tested (14 devices, 28 browsers):
Droid 2 Global Android 2.2
iPhone 4 iOS5 (Safari, Opera Mini)
Motorola Atrix Android 2.3.4 (Stock browser, Dolphin, Skyfire, Opera Mini, Firefox)
Samsung Galaxy S9000 Android 2.3 (Webkit, Opera Mobile)
Samsung Galaxy Y Android 2.3.5
#!/usr/bin/python
import gdata.contacts.service
gd_client = gdata.contacts.service.ContactsService()
gd_client.ClientLogin('[email protected]', 'password')
query = gdata.contacts.service.ContactsQuery()
query.max_results = 500 # change for max contacts returned
feed = gd_client.GetContactsFeed(query.ToUri())
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@davidandrzej
davidandrzej / GoogleContactCleanup.py
Created September 24, 2011 20:16
Script to help semi-automatically tidy up Google contacts
"""
Python script to help programmatically tidy up Google contacts
Example workflow:
1) export Google contacts and back this file up somewhere
(must use Outlook CSV format b/c Python csv chokes on Unicode)
2) run this script to generate a cleaned-up CSV contacts file
3) in Google contacts, delete all and re-import from this new CSV
4) use Google contacts merge/delete for finishing touches
"""
@rizumu
rizumu / fab.py
Created September 21, 2011 23:50
install irssi
def install_irssi():
sudo("apt-get install -y screen irssi bitlbee libcrypt-dh-perl libcrypt-openssl-bignum-perl libcrypt-blowfish-perl")
# libtime-duration-perl libnotify-bin irssi-plugin-otr bitlbee-plugin-otr")
server_ip = env.host_string.split(":")[0]
local("rsync --links -e 'ssh -p {0}' -avzp ~/.irssi/ {1}@{2}:{3}.irssi/ \
--exclude='*.log'".format(settings.SSH_PORT, settings.DEPLOY_USERNAME, server_ip, settings.DEPLOY_HOME))
sed("{0}.irssi/config".format(settings.DEPLOY_HOME), "BITLBEE_PASSWORD", os.environ["BITLBEE_PASSWORD"])
with fab_settings(warn_only=True):
put("~/.screenrc", os.path.join(settings.DEPLOY_HOME, ".screenrc"))
put("~/dotfiles/bitlbee.conf", "/etc/bitlbee/bitlbee.conf", use_sudo=True)
@mathiasbynens
mathiasbynens / jquery.loadasync.js
Created September 6, 2011 09:44
Use jQuery to load scripts asynchronously
// Load scripts asynchronously
jQuery.loadAsync = function(url, callback) {
// Don't use $.getScript since it disables caching
jQuery.ajax({
'url': url,
'dataType': 'script',
'cache': true,
'success': callback || jQuery.noop
});
};
@jpcody
jpcody / upload-clipboard.rb
Created September 3, 2011 01:06
Save clipboard contents as private gist using Alfred.app
# It'd be great to get this running via AppleScript and sans Alfred if anyone with more knowledge than me knows how :)
### STEP 1
#!/bin/sh
# Save this file as /bin/rvm_ruby, and do chmod 755 /bin/rvm_ruby
# to give it the proper permissions
# From http://www.aeonscope.net/2011/05/29/connecting-alfred-to-bitly-via-ruby/
if [[ -s ~/.rvm/scripts/rvm ]]; then
@valotas
valotas / run.js
Created August 27, 2011 14:23
Trying to make a small scrapy like app with nodejs
var scrapy = require('./scrapy.js').scrapy,
getAdFromTD = function( $td ) {
var ad = {
title: $td.find('a').html().replace(/\s*$/g, '')
},
type;
$td = $td.next();
ad.address = $td.find('a').html().replace( /<br>/g, ',' );
@mxriverlynn
mxriverlynn / 1-referencing.js
Created July 19, 2011 13:57
using an event aggregator with backbone
MedicationView = Backbone.View.extend({
events: {
"click #edit": "editMedication"
},
editMedication: function(){
var editView = new AddEditView({model: this.model});
editView.render();
}
});
@jugglinmike
jugglinmike / boaz_leverage.js
Created June 15, 2011 19:45
Using the Strategy pattern in JavaScript
$.each( buttons, function( propertyName, button ) {
$('<button>', {
html: button.label,
id: propertyName
})
.bind('click', button.action)
.appendTo( 'nav' );
});