Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View aziz's full-sized avatar

Allen Bargi aziz

  • Gothenburg, Sweden
View GitHub Profile
require 'pony'
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret, authtype if user or secret
@paulirish
paulirish / README.md
Created January 4, 2010 02:38
imagesLoaded() jquery plugin
$ rackup -p 8880 static.ru
# The following initializer provides an :alias => "my_route_name" option to restful routes in your
# route.rb. This simply makes the same route also available under a different …_path / …_url helpers.
# For example,
# map.resources :notes, :alias => :snippets
# Gives you
# notes_path, notes_url, new_note_path... #as always
@rtdp
rtdp / gist:742461
Created December 15, 2010 19:27
Importing Gmail Contacts list to Rails Application.
class ImportedContactsController << ApplicationController
require 'net/http'
require 'net/https'
require 'uri'
#THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE.
def authenticate
# initiate authentication w/ gmail
# create url with url-encoded params to initiate connection with contacts api
# next - The URL of the page that Google should redirect the user to after authentication.
# scope - Indicates that the application is requesting a token to access contacts feeds.
@coreyhaines
coreyhaines / churn script
Created February 16, 2011 19:04
Bash script to generate churn counts in git repo
churn number and file name
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}'
churn number and file name w/ limiting to last n commits
git log --all -n 5000 -M -C --name-only | grep -E '^spec/models' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}'
graph of churn number and frequency
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk '{print $1}' | uniq -c | sort | awk 'BEGIN { print "frequency,churn_count"} { print $1,$2}'
@rezb
rezb / devise.fa.yml
Created April 23, 2011 22:34
Persian (fa) translations for Devise (https://github.com/plataformatec/devise/wiki/I18n)
fa:
errors:
messages:
expired: 'منقضی شده، لطفا درخواست جدید بدهید'
not_found: 'یافت نشد'
already_confirmed: 'قبلا تایید شده، لطفا وارد شوید'
not_locked: 'قفل نشده است'
not_saved:
one: '۱ خطا جلوی ذخیره %{resource} را گرفت:'
other: '%{count} خطا جلوی ذخیره این %{resource} را گرفت:'
@alexyoung
alexyoung / deploy.sh
Created May 17, 2011 10:47
Deployment script
#!/usr/bin/env bash
# Configuration
SERVER='myserver'
DEPLOY_TO='/path/to/app'
EXCLUDE='*.swp .git/ db/sphinx/ tmp/ log/'
DRY_RUN=false
DEPLOY_GEM_PATH='/opt/ec/ruby/1.8.7/lib/ruby/gems/1.8'
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@necolas
necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],