Skip to content

Instantly share code, notes, and snippets.

View dannluciano's full-sized avatar
🏠
Working from home

Dann Luciano dannluciano

🏠
Working from home
View GitHub Profile
@davidcelis
davidcelis / 1.9.3-p362-perf.md
Last active October 17, 2016 11:28 — forked from burke/0-readme.md
Ruby 1.9.3-p362 cumulative performance patch for rbenv

NOTE: THIS PATCH DOES NOT APPLY. Falcon's performance patches have not been updated for p362. See the comments for a fork that uses the Rails Express patch set instead.

ruby-1.9.3-p362 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p362 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

// g++ -std=c++11 random.cpp -o random
#include <iostream>
#include <random>
int main ()
{
std::random_device rd;
std::cout << "default random_device characteristics:" << std::endl;
std::cout << "minimum: " << rd.min() << std::endl;
anonymous
anonymous / random.cpp
Created December 24, 2012 04:37
Random Device
// g++ -std=c++11 random.cpp -o random
#include <iostream>
#include <random>
int main ()
{
std::random_device rd;
std::cout << "default random_device characteristics:" << std::endl;
std::cout << "minimum: " << rd.min() << std::endl;
@caike
caike / spec_helper.rb
Created October 25, 2012 15:09
missing translations
##
# Raises error if missing translation key
##
config.before(:all, type: :controller) do
@_i18n_exception_handler = I18n.exception_handler
I18n.exception_handler = lambda { |*args| raise args.first.to_s }
end
config.after(:all, type: :controller) do
I18n.exception_handler = @_i18n_exception_handler
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@fnando
fnando / controller_made_by_unicorns.rb
Created September 2, 2012 14:25
Just a refactored controller that uses a custom responder instead of those nasty respond_to blocks.
class NotesController < ApplicationController
self.responder = NotesResponder
def create
@page = Page.find(params[:page_id])
@note = page.notes.create(params[:note])
respond_with(@note, :location => page_path(@page))
end
end
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@fnando
fnando / dnsimple_backup.rb
Created July 24, 2012 02:26
Backup your DNSimple records
# gem install dnsimple-ruby
# $ <SPACE>PASSWORD="your password" EMAIL="your e-mail" ruby dnsimple_backup.rb > dnsimple_backup.yml
# when you put a space before running a command you prevent it from being added to the history.
require "dnsimple"
require "yaml"
DNSimple::Client.username = ENV.fetch("EMAIL")
DNSimple::Client.password = ENV.fetch("PASSWORD")
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 19, 2025 12:44
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname