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
# read more at https://terrty.net/2014/ssl-tls-in-nginx/ | |
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf | |
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net | |
# your nginx version might not have all directives included, test this configuration before using in production against your nginx: | |
# $ nginx -c /etc/nginx/nginx.conf -t | |
server { | |
# public key, contains your public key and class 1 certificate, to create: | |
# (example for startssl) | |
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null |
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() { |