This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix. | |
;; | |
;; * :use makes functions available without a namespace prefix | |
;; (i.e., refers functions to the current namespace). | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_config klass | |
var = klass.new | |
unless !var.respond_to?(:to_ary) && [var].flatten == [var] | |
puts "#{klass.name} is misbehaved" | |
end | |
end | |
class RespondToMissingTest | |
def respond_to_missing? method, *rest | |
if method.to_sym == :to_ary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int foo = 4; | |
if(1) { | |
int foo = 5; | |
printf("%i", foo); | |
} | |
printf("%i", foo); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in application.rb | |
module YourApp | |
class Application < Rails::Application | |
config.middleware.insert_before ActionDispatch::ParamsParser, "ParsingFailureToJSON" | |
... | |
end | |
end | |
#The Parsing failure middleware | |
class ParsingFailureToJSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var child_process = require('child_process'); | |
var child = child_process.fork('./slave.js'); | |
child.on('exit', function() {console.log(1)}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem "chronic", "0.2.3" | |
gem "main", "4.7.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install --version '= 2.3.11' rails | |
gem install --version '= 1.0.4' uuid | |
gem install validatable | |
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
gem install --version '2.4.4' facets | |
gem install --version '4.0.0' htmlentities | |
gem install httpclient --version '= 2.1.2' | |
gem install --version '= 0.9.8' mocha | |
gem install --version '= 1.2.6' fakeweb | |
gem install --version '= 2.2.0' fattr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elarkin-vibes:splat evan.larkin$ gem install soap4r --version '= 1.5.8' | |
Abort trap | |
elarkin-vibes:splat evan.larkin$ rake gems:install --trace | |
(in /Users/evan.larkin/source/splat) | |
** Invoke gems:install (first_time) | |
** Invoke gems:base (first_time) | |
** Execute gems:base | |
** Invoke environment (first_time) | |
** Execute environment | |
=> QueryTrace disabled; CTRL-\ to toggle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.async = function require_async(module, continuation) { | |
//quick! pretend to be async! | |
continuation(require(module)); | |
//alternately, actually be async: | |
//process.nextTick(function() { | |
// continuation(require(module)); | |
//}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.module = (function() { | |
var module = {}; | |
var modules = {}; | |
module.require = function require(mod_name) { | |
return modules[mod_name]; | |
}; | |
module.declare = function declare(f) { | |
if(typeof f === 'function') { | |
var m = {}; |