Skip to content

Instantly share code, notes, and snippets.

View aziz's full-sized avatar

Allen Bargi aziz

  • Gothenburg, Sweden
View GitHub Profile
@aziz
aziz / datasize.rake
Created February 11, 2010 15:50
DB rake
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
# Newbie Programmer
def factorial(x)
if x == 0
return 1
else
return x * factorial(x - 1)
end
end
puts factorial(6)
puts factorial(0)
@aziz
aziz / snippet.txt
Created April 24, 2010 22:11 — forked from anonymous/snippet.txt
nginx.conf
# --prefix=/usr --add-module=/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access_log --error-log-path=/var/log/nginx/error_log --with-http_ssl_module --with-http_geoip_module --with-http_realip_module --with-http_addition_module --with-http_stub_status_module --with-http_flv_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --add-module=/home/aziz/nginx-modules/http_push_module --add-module=/home/aziz/nginx-modules/upload_progress_module --add-module=/home/aziz/nginx-modules/zip_module --add-module=/home/aziz/nginx-modules/memc_module --add-module=/home/aziz/nginx-modules/mp4_stream_module
# --with-http_ssl_module
# --with-http_geoip_module
# --with-http_realip_module
# --with-http_addition_module
# --with-http_stub_status_module
# --with-http_flv_module
# --add-module=/ht
@aziz
aziz / devise.fa.yml
Created April 26, 2011 14:48 — forked from rezb/devise.fa.yml
Persian (fa) translations for Devise (https://github.com/plataformatec/devise/wiki/I18n)
fa:
errors:
messages:
not_found: "یافت نشد"
already_confirmed: "قبلا تایید شده است"
not_locked: "قفل نشده است"
not_saved:
one: "۱ خطا جلوی ذخیره %{resource} را گرفت:"
other: "%{count} خطا جلوی ذخیره این %{resource} را گرفت:"
@aziz
aziz / deploy.sh
Created May 18, 2011 22:25 — forked from alexyoung/deploy.sh
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'
@aziz
aziz / snippet.js
Created September 28, 2011 21:03 — forked from necolas/snippet.js
Optimise DOM insertion of cross-domain scripts
( function ( win, doc ) {
// Google Analytics global variable
win._gaq = [ ['_setAccount','UA-XXXXX-X'], ['_trackPageview'], ['_trackPageLoadTime'] ];
// Array of cross-domain script urls
var urls = [
'//connect.facebook.net/en_US/all.js', // Facebook SDK
'//platform.twitter.com/widgets.js', // Twitter Widgets
'https://apis.google.com/js/plusone.js', // Google +1 Button
@aziz
aziz / .tmux.conf
Created January 29, 2012 01:53 — forked from paulrouget/.tmux.conf
Paul's configurations files
set -g default-terminal "screen-256color"
set -g status-utf8 on
bind M source-file ~/.tmux/mac.session
bind L source-file ~/.tmux/linux.session
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# THEME
set -g status-bg black
#!/usr/bin/env ruby
#
# This script is an astonishing feat of top notch
# rockstar craftsmanship. It totally uses artificial
# intelligence to extract colors out of tmTheme and
# build an itermcolors scheme file for iTerm2.
#
# I know this sounds crazy, but it actually knows
# approximately what colors should be used in the
# ANSI list, and tries to find nearest colors from