Skip to content

Instantly share code, notes, and snippets.

View christos's full-sized avatar

Christos Zisopoulos christos

View GitHub Profile
ActionView::Helpers::AssetTagHelper.register_javascript_expansion({
html5shiv: "http://html5shiv.googlecode.com/svn/trunk/html5.js",
ie7js: "http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js",
ie8js: "http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js",
jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"
})
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@christos
christos / gist:459765
Created July 1, 2010 09:29 — forked from defunkt/gist:132456
Bash snippet to open new shells in most recently visited dir.
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
\cd
else
# Clone rails from github
git clone git://github.com/rails/rails.git ~/Desktop/rails
cd ~/Desktop/rails
# Create a 2.3.8 vanila app
git co v2.3.8
ruby ./railties/bin/rails ~/Desktop/rails2app
# Generate some models and a controller
cd ~/Desktop/rails2app
@christos
christos / gist:567537
Created September 6, 2010 21:33 — forked from zachinglis/gist:143695
Make port 80 "real life" speeds
# Make port 80 "real life" speeds
# You can also use Mongrel ports.
function slow_port {
# Set the port variable if no port inputted. Defaulted to 80 (for Passenger).
if [ -z "$1" ]
then port=80
else port=$1
fi
# Slow the ports.
Dear Christos
Hope all is well
I have a position that I feel you may be interested in. (My apologies if this email is not of relevance to you)
The role is for an international client of mine and they are looking for the following:
My client, a market leader in virtual currency monetization, are looking for a senior software developer to engineer their platform to cope with growing traffic and business requirements.Tasks include designing and developing an in-house advertising & payment platform based on Ruby on Rails and working with the other lead developers to engineer a well-designed, maintainable and performing technology platform that can cope with the continuously growing traffic and business requirements.
@christos
christos / etc-init-d-monit
Created November 10, 2010 14:29
EC2 config files
#! /bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
@christos
christos / cache_with_comment.rb
Created December 30, 2010 12:32
Surround cached fragments with HTML comments (Rails 2.3 initalizer)
module ActionController
module Caching
module Fragments
def read_fragment_with_comment(name, options)
fragment = read_fragment_without_comment(name, options)
fragment && "\n<!-- cache-hit: #{name} -->\n#{fragment}\n<!-- /cache-hit: #{name} -->\n" || nil
end
alias_method_chain :read_fragment, :comment
#!/usr/bin/ruby -w
=begin
/***************************************************************************
* Copyright (C) 2008, Paul Lutus *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@christos
christos / jazzfonica.rb
Created June 14, 2011 09:37
jazzfonica
#!/usr/bin/env ruby
# jazzfonica.rb for Mac OS X
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal
require 'digest/md5'
messages = []
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport')