function hOP (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key)
}
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
class LRU | |
attr_reader :content | |
attr_accessor :max | |
def initialize(max, hash={}) | |
@max = max | |
@content = hash | |
end | |
def [](key) |
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 <string.h> | |
#include <uthash.h> | |
// this is an example of how to do a LRU cache in C using uthash | |
// http://uthash.sourceforge.net/ | |
// by Jehiah Czebotar 2011 - [email protected] | |
// this code is in the public domain http://unlicense.org/ | |
#define MAX_CACHE_SIZE 100000 |
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
module Middle | |
module Base | |
def self.included(base) | |
base.extend self | |
end | |
def returning value=nil | |
throw :done, value | |
end | |
end |
- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
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
F.* | |
sample test | |
Tape::Failure | |
/tmp/tape.rb:118:in `fail!' | |
/tmp/tape.rb:104:in `fail_if' | |
/tmp/1.rb:14:in `block in <main>' | |
/tmp/tape.rb:43:in `instance_eval' | |
/tmp/tape.rb:43:in `call' | |
/tmp/tape.rb:128:in `block in run' |
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
(global-set-key (kbd "<f5>") 'F5) | |
(defun magic-F5 (f) | |
(fset 'F5 f)) |
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
class Module | |
def alias_method_chain(target, feature) | |
# Strip out punctuation on predicates or bang methods since | |
# e.g. target?_without_feature is not a valid method name. | |
aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1 | |
yield(aliased_target, punctuation) if block_given? | |
with_method = "#{aliased_target}_with_#{feature}#{punctuation}" | |
without_method = "#{aliased_target}_without_#{feature}#{punctuation}" |
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 rubyzip --version "=0.9.9" | |
gem install selenium-webdriver --version "~>2.20.0" | |
gem install watir-webdriver |
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
class Array | |
class It | |
def initialize(it) | |
define_singleton_method(:it) { it } | |
end | |
end | |
def self.iter_with_it(*methods) | |
methods.each { |m| | |
old = "_#{m.to_s}".to_sym |