Skip to content

Instantly share code, notes, and snippets.

View adimircolen's full-sized avatar

Adimir Colen adimircolen

View GitHub Profile
@tmm1
tmm1 / gist:329682
Created March 11, 2010 21:31
EM Chat Server Demo
require 'rubygems'
require 'eventmachine'
require 'em-http' # gem install em-http-request
require 'yajl' # gem install yajl-ruby
class String
def bold
"\033[1m#{self}\033[0m"
end
end
@carlosantoniodasilva
carlosantoniodasilva / gist:701163
Created November 15, 2010 23:21
Rails 3.0.2 "visit_Foo" Arel error
require 'rubygems'
require 'sqlite3'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3', :database => ':memory:'
)
ActiveRecord::Schema.define(:version => 0) do
create_table :users, :force => true do |t|
@jjb
jjb / gist:950975
Created May 1, 2011 23:16
Using whenever with capistrano and bundler in multiple environments
We couldn’t find that file to show.
@adimircolen
adimircolen / aws_cf_invalidate.rb
Created November 22, 2011 22:20 — forked from objectoriented/aws_cf_invalidate.rb
Ruby script to invalidate objects on Amazon's CloudFront CDN (shows status of recent requests also)
require 'rubygems'
require 'hmac-sha1' # on OS X: sudo gem install ruby-hmac
require 'net/https'
require 'base64'
#
# CHANGE ME: S3 access credentials go here, along with CloudFront Distribution ID
#
s3_access=''
s3_secret=''
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@sowawa
sowawa / .recipe
Created April 28, 2012 03:45
Installing rails 4.0.0 beta
thumbnail: http://pds.exblog.jp/pds/1/201101/16/02/d0055302_13383029.jpg
video: http://www.youtube.com/watch?v=UE27t_LJpx0
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@emad-elsaid
emad-elsaid / worm.rb
Created March 19, 2014 12:15
Worm game in under 50 line of code in ruby
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
@everaldo
everaldo / unicorn-app.sh
Created March 21, 2014 14:29
Gist /etc/init.d script do Unicorn
################################################################################
# unicorn.sh
################################################################################
#!/usr/bin/env bash
set -e
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
AS_USER="USER_NAME"
@wojtha
wojtha / gist:e9ed6f355e2222875a50
Created November 12, 2014 15:03
xdotool - scripting X11 from command line
# Absolute switching
xdotool set_desktop 0
xdotool set_desktop 1
xdotool set_desktop 2
xdotool set_desktop 3
# Relative switching
xdotool set_desktop $(echo $(($(xdotool get_desktop) + 1)))
xdotool set_desktop $(echo $(($(xdotool get_desktop) - 1)))