Skip to content

Instantly share code, notes, and snippets.

View carlosantoniodasilva's full-sized avatar
👨‍💻
Hacking beautiful code...

Carlos Antonio da Silva carlosantoniodasilva

👨‍💻
Hacking beautiful code...
View GitHub Profile
@rodrigotassinari
rodrigotassinari / gist:1078666
Created July 12, 2011 18:47 — forked from sagmor/gist:1041943
Patched Ruby 1.9.2 for faster load and GC
# Ruby 1.9 Fast require:
# https://gist.github.com/1008945
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > load.patch
# Ruby 1.9.2 GC Patch:
# https://gist.github.com/856296
curl https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch > gc.patch
rvm install 1.9.2-p180 --patch load.patch,gc.patch -n loadgc
rm gc.patch load.patch
@lucasmazza
lucasmazza / documentup.sh
Created February 2, 2012 23:52
Using documentup with a local README.
# gem install bcat
curl -X POST --data-urlencode content@README.md http://documentup.com/compiled | bcat
@granth
granth / delayed_job_airbrake.rb
Created March 28, 2012 04:54
delayed_job exception notification with airbrake
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
::Airbrake.notify_or_ignore(error)
super
end
end
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
#yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
# make bzip2 autoconf automake libtool bison iconv-devel git-core
@fabioyamate
fabioyamate / example.js
Last active December 15, 2015 20:09
Mediator pattern for event stream with context bind.
var person = { name: "John" };
window.name = "Paul";
mediator.on("call-people", function() {
console.log(this.name); // print "Paul"
});
mediator.on("call-people", function() {
console.log(this.name); // print "John"

If one was inclined to use the acts_as_yaffle pattern, they would probably use the second one, rather than the heavily cargo-culted first one.

@mislav
mislav / git.md
Last active May 20, 2020 14:52
git merge, reset, rebase, checkout

What I believe is the most confusing thing for git beginners is that the main commands have multiple uses depending on the arguments or context, and some of those uses aren't well-described by the command's name.

Merge

  • merges together different branches (different histories, to be more exact)
  • fast-forwards if a merge isn't necessary; effectively repositioning the branch head to a descendant commit
  • unwanted outcome of git pull

Rebase

@JamesDullaghan
JamesDullaghan / digitalocean.md
Created July 6, 2013 20:54
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@ivanvanderbyl
ivanvanderbyl / gist:4222308
Created December 6, 2012 06:55
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else