Skip to content

Instantly share code, notes, and snippets.

View djq's full-sized avatar

David Quinn djq

  • Google
  • Dublin
View GitHub Profile
@johnpolacek
johnpolacek / lazyloadimages.js
Last active December 17, 2015 14:59
Lazy Load Images
// <a href="product.html" data-lazy-image="product.jpg" data-lazy-image-alt="The Product"></a>
;(function($) {
$('*[data-lazy-image]').each(function() {
var alt = $(this).attr('data-lazy-image-alt') === undefined ? '' : 'alt="'+$(this).attr('data-lazy-image-alt')+'"';
$(this).append($('<img src="'+$(this).attr('data-lazy-image')+'" '+alt+'" />'));
});
}(jQuery));
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
from oauth2 import Token
from social_auth.backends.utils import build_consumer_oauth_request
from social_auth.backends.facebook import FacebookAuth
def facebook_profile_image(user):
try:
social_auth = user.social_auth.filter(provider='facebook')[0]
except IndexError:
return []
@sd
sd / ponche-crema-receta.markdown
Last active February 18, 2024 21:08 — forked from anibal/ponche-crema-receta.markdown
Granny's Carúpano Style Egg Nog (Ponche Crema Carupanero)

Granny's Carúpano Style Egg Nog (Ponche Crema Carupanero)

Ingredients

  • 1 bottle of Whistle Pig bourbon whiskey (or rye), 1 bottle of Bruichladdich scotch whisky
  • 30 egg yolks
  • 4 cans of condensed milk (14 oz / 397g per can)
  • 1 bottle of rum (750 ml)
Stop number Name without locality Locality Locality number Code Name NaPTAN stop class NaPTANId Easting Northing
1 Pearse Street (Pearse Avenue) Sallynoggin E0825024 ->NE2 Stop No. 3234 BCT 8250DB003234 724091 726427
1 Pearse Street (Pearse Avenue) Sallynoggin E0825024 ->SW1 Stop No. 3210 BCT 8250DB003210 724087 726412
2 Lr. Drumcondra Road Drumcondra (Dublin) E0822021 1 Drumcondra Road Lower BCT 825000101 715947 736197
2 Lr. Drumcondra Road Drumcondra (Dublin) E0822021 2 Drumcondra Road Lower BCT 8250B1001201 715929 736199
3 Clontarf Road Junction Strandville Avenu Clontarf E0822038 1 Stop No. 1741 BCT 8220DB001741 718428 736222
4 College Green Dublin City South E0822091 1 Taxi Rank TXR 8220TR000078 715797 734107
4 College Green Dublin City South E0822091 2 Stop No. 1359 BCT 8220DB001359 715770 734095
4 College Green Dublin City South E0822091 3 College Green BCT 825000157 715769 734095
4 College Green Dublin City South E0822091 4 Stop No. 4522 BCT 8220DB004522 715821 734081
@cspanring
cspanring / ubuntu-django-setup.md
Created September 12, 2012 12:26
A few quick steps to setup Ubuntu 10.04 as Django application server

Basic Ubuntu 10.04.3 LTS server setup to deploy Django appplications

This document covers basic steps to setup

  • a django user who will serve Django applications,
  • [Nginx] as web server,
  • [Gunicorn] as a WSGI and
  • [PostgreSQL] with [PostGIS] as database server.

...on a default Ubuntu 10.04 server installation.

@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@garnaat
garnaat / gist:2917662
Created June 12, 2012 13:55
Example using boto to create an IAM role and associate it with an EC2 instance
In [1]: policy = """{
...: "Statement":[{
...: "Effect":"Allow",
...: "Action":["s3:*"],
...: "Resource":["arn:aws:s3:::mybucket"]}]}"""
In [2]: import boto
In [4]: c = boto.connect_iam()
In [5]: instance_profile = c.create_instance_profile('myinstanceprofile')
In [6]: role = c.create_role('myrole')
In [7]: c.add_role_to_instance_profile('myinstanceprofile', 'myrole')