Skip to content

Instantly share code, notes, and snippets.

View christos's full-sized avatar

Christos Zisopoulos christos

View GitHub Profile
#!/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 / 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
@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
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 / 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.
# 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: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
# 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
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"
})
@christos
christos / remotable.jquery132.js
Created January 17, 2010 22:16
Example remotable.js for Protytpe 1.6 and jQuery 1.3.2 with livequery
jQuery.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
});
$('a[data-remote="true"]').live('click', function(e) {
var $link = $(this);
var method = $link.attr('data-method') || 'get';
var url = $link.attr('href');
var type = (method == 'get') ? 'GET' : 'POST';