Skip to content

Instantly share code, notes, and snippets.

View achiurizo's full-sized avatar
❄️

Arthur Chiu achiurizo

❄️
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
@nesquena
nesquena / base.conf
Last active February 28, 2020 11:35
nginx configuration
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
tcp_nopush on;
@nesquena
nesquena / Uniform Setup.md
Created August 3, 2010 22:30
Uniform Server Setup

Enable universe repository:

# /etc/apt/sources.list

## main & restricted repositories
deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted universe

deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe

@postmodern
postmodern / http_parser.rb
Created January 15, 2011 04:39
A pure Ruby HTTP parser using Parslet.
require 'parslet'
require 'pp'
class HTTPParser < Parslet::Parser
#
# Character Classes
#
rule(:digit) { match('[0-9]') }
rule(:digits) { digit.repeat(1) }
rule(:xdigit) { digit | match('[a-fA-F]') }
require 'net/http'
require 'json'
###
# Stupid simple class for uploading to imgur.
#
# client = Imgur2.new 'my imgur key'
# p File.open(ARGV[0], 'rb') { |f|
# client.upload f
# }
@jeffkreeftmeijer
jeffkreeftmeijer / blobs.png
Created March 30, 2011 17:44
Counting blobs in an image in Ruby
blobs.png
#!/bin/sh -x
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git pull --rebase origin master
git checkout ${CURRENT}
git rebase master
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@mrrooijen
mrrooijen / deploy.rb
Created May 16, 2011 18:12
Unicorn + Bluepill + Capistrano with RVM
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :application, "my_app"
set :repository, "git@trunksapp.com:myuser/myapp.git"
set :branch, "production"
set :rvm_ruby_string, "1.9.2"
set :deploy_to, "/var/applications/"
set :user, "username"
@danishkhan
danishkhan / MongoSF_Notes.md
Created May 25, 2011 00:14
Mongo Notes from MongoSF 20011

MongoDB Notes

Building Web Apps with MongoDB

MongoDB Schema Design