This file contains 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 Cache | |
attr_reader :limit, :store, :queue | |
def [](key) | |
heat(key) if result = store[key] | |
result | |
end | |
def []=(key, value) |
This file contains 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 Password = {}, | |
utils; | |
function getOptionNum(target, defaults, rest) { | |
if (typeof(defaults) == 'undefined') defaults = 0; | |
var val = (typeof(target) == 'undefined') ? defaults : target; | |
if (val > rest) val = rest; |
This file contains 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 'spec_helper' | |
describe Aequitas::Violation, '#resource' do | |
subject { object.resource } | |
let(:object) { described_class.new(rule, resource) } | |
let(:rule) { mock('Rule') } | |
let(:resource) { mock('Resource') } | |
it { should equal(resource) } |
This file contains 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 'mina/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org) | |
# require 'mina/rvm' # for rvm support. (http://rvm.io) | |
# Basic settings: | |
# domain - The hostname to SSH to. | |
# deploy_to - Path to deploy into. | |
# repository - Git repo to clone from. (needed by mina/git) |
This file contains 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 Abstract | |
def abstract(meth, args=[]) | |
define_method(meth.to_sym) do |*params| | |
raise NotImplementedError, "method ##{meth} should be implemented with arguments (#{ args.join(', ') })" | |
end | |
end | |
end | |
class Hello | |
extend Abstract |
This file contains 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
define(["bee/widget", "app/models/transport", "app/modules/cargo-log"], function(Widget, Transport, CargoLog) { | |
"use strict"; | |
var Transports = new Widget({ | |
root: "#transports-sidebar", | |
extends: [CargoLog], | |
init: function() { | |
this.transports = []; |
This file contains 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 Hello = Class({ | |
attrReader: "val", | |
initialize: function(val) { | |
this.val = val; | |
}, | |
publicFn: function() { | |
console.log(this.val); | |
this.privateFn(); |
This file contains 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
App = {}; | |
// Another sandbox functions | |
/** | |
* Creates namespace in sandbox by string definition | |
* If part of namespace already defined - keep it untouchable, | |
* else - create empty object. | |
* | |
* App.namespace("Hello.World"); |
This file contains 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 Baby = (function() { | |
function Baby(name) { // Constructor | |
this.name = name; | |
} | |
Baby.prototype = { // Public | |
introduce: function() { | |
alert("Hello! My name is " + name); | |
}, | |
play: function() { |
This file contains 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
[BUG] Segmentation fault | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
-- Control frame information ----------------------------------------------- | |
c:0007 p:---- s:0021 b:0021 l:000020 d:000020 CFUNC :next! | |
c:0006 p:0049 s:0018 b:0018 l:000017 d:000017 METHOD /Users/ptico/.rvm/gems/ruby-1.9.3-p0/gems/data_objects-0.10.7/lib/data_objects/reader.rb:35 | |
c:0005 p:---- s:0014 b:0014 l:000013 d:000013 FINISH | |
c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :to_a | |
c:0003 p:0087 s:0009 b:0008 l:001638 d:002478 EVAL do.rb:8 | |
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH |