Skip to content

Instantly share code, notes, and snippets.

View justincampbell's full-sized avatar
🌯
🍩

Justin Campbell justincampbell

🌯
🍩
View GitHub Profile
class Game
attr_accessor :home
attr_accessor :away
def initialize(home, away)
@home = home
@away = away
end
def city
Dividata::Application.config.middleware.use Rack::Attack
Rack::Attack.whitelist("localhost") do |request|
['127.0.0.1'].include? request.ip
end
Rack::Attack.throttle 'requests/minute', limit: 60, period: 1.minute, &:ip
Rack::Attack.throttle 'requests/hour', limit: 600, period: 1.hour, &:ip
Rack::Attack.throttle 'requests/day', limit: 3000, period: 1.day, &:ip
@justincampbell
justincampbell / output.txt
Created February 25, 2015 16:57
Devstack default role assignments
User 'glance' has role '_member_' in scope 'project:service'
User 'glance' has role 'service' in scope 'project:service'
User 'nova' has role 'ResellerAdmin' in scope 'project:service'
User 'nova' has role 'admin' in scope 'project:service'
User 'nova' has role '_member_' in scope 'project:service'
User 'swiftusertest3' has role 'anotherrole' in scope 'project:swifttenanttest1'
User 'swiftusertest3' has role '_member_' in scope 'project:swifttenanttest1'
User 'demo' has role 'heat_stack_owner' in scope 'project:demo'
User 'demo' has role 'Member' in scope 'project:demo'
User 'demo' has role 'anotherrole' in scope 'project:demo'
class After
def worked?; true; end
end
module Newless
module_function
def newless(klass)
method_name = klass.name.to_sym
return if \
module Guillemets
def inspect; "<<#{self}>>"; end
end
Value = Struct.new(:value) do
include Guillemets
def reducible?; false; end
end
Operation = Struct.new(:left, :right) do
$ tree -L 3 $GOPATH/src
/Users/Justin/Code/go/src
├── bitbucket.org
│   └── mountdiablo
│   └── ce_nikola
├── code.google.com
│   └── p
│   ├── go-uuid
│   ├── go.tools
│   ├── goplan9

Thrift Support for HTTP

Language HTTP
Clojure Client
Erlang Client
Go Client
Haskell Client
Node Yes
OCaml No
puts "About to define BaseService"
class BaseService
puts "BaseService code running"
def self.clone; puts "clone called"; super; end
def self.dup; puts "dup called"; super; end
end
puts "About to inherit from BaseService"
class ClassOne
def name
:one
end
end
ClassOne.new.name # => :one
ClassTwo = Class.new do
def name
use std::collections::HashMap;
type Token = String;
type Url = String;
struct World { id: int, urls: HashMap<Token, Url> }
fn main() {
let mut world = World { urls: HashMap::new(), id: 0i };