Skip to content

Instantly share code, notes, and snippets.

View emerleite's full-sized avatar

Emerson Macedo emerleite

View GitHub Profile
@emerleite
emerleite / method_missing.js
Last active August 26, 2015 13:52 — forked from hagino3000/method_missing.js
__noSuchMethod__ for Chrome
/**
* Enable route to __noSuchMethod__ when unknown method calling.
*
* @param {Object} obj Target object.
* @return {Object}
*/
function enableMethodMissing(obj) {
var functionHandler = createBaseHandler({});
functionHandler.get = function(receiver, name) {
@emerleite
emerleite / 0_reuse_code.js
Created July 15, 2014 14:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@emerleite
emerleite / hell.js
Created January 15, 2014 12:34 — forked from kaiquewdev/hell.js
// Promessas podem resolver a sua vida.
// Mas se o Javascript foi pensado desta forma, com a possibilidade
// de funções dentro de funções, então existiria algum recurso para resolver este problema?
// Bom, não tem um recurso especifico que vai fazer a sua vida mudar, mas com algum conhecimento
// sobre a linguagem, você acaba descobrindo que isso pode acontecer.
// Primeiro exemplo - #1
function sayHello () {
@emerleite
emerleite / install-nodejs.sh
Created August 9, 2012 13:47 — forked from TooTallNate/install-nodejs.sh
Simple Node.js installation script using the precompiled binary tarballs
#!/bin/sh
VERSION=0.8.6
PLATFORM=darwin
ARCH=x64
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"
@emerleite
emerleite / mountain-lion-brew-setup.markdown
Created August 1, 2012 10:39 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@emerleite
emerleite / gist:2603107
Created May 5, 2012 15:01 — forked from snatchev/gist:1316470
resque worker devise not eager loading
❷ > QUEUE=* rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:preload
rake aborted!
No such file to load -- devise/confirmations_controller
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on'
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on'
@emerleite
emerleite / vagrant.md
Created March 12, 2012 19:44
Installing CentOS 5.6 64-bit and Puppet on Vagrant

Installing CentOS 5.6 64-bit and Puppet on Vagrant

Notes

This document is an adaptation of the instructions found here: http://vagrantup.com/docs/base_boxes.html

These instructions are specifically for 64-bit CentOS and Puppet.

Created with the following software:

@emerleite
emerleite / gist:1424769
Created December 2, 2011 20:46 — forked from tomlea/gist:207938
This is very rough and ready.
require "net/http"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
#
require 'net/http'
class ServerProxy
def self.call(env)
if env["PATH_INFO"] =~ /^\/server_proxy/
request = Rack::Request.new(env)
params = request.params
Net::HTTP.start(params["service_url"]) {|http|
req = Net::HTTP::Get.new(params["service_path"])