Skip to content

Instantly share code, notes, and snippets.

View cpb's full-sized avatar
🏠
Working from home

Caleb Buxton cpb

🏠
Working from home
View GitHub Profile
Prefix Verb URI Pattern Controller#Action
stimulus POST /stimulus(.:format) stimulus#create
new_stimulus GET /stimulus/new(.:format) stimulus#new
edit_stimulus GET /stimulus/edit(.:format) stimulus#edit
GET /stimulus(.:format) stimulus#show
PATCH /stimulus(.:format) stimulus#update
PUT /stimulus(.:format) stimulus#update
DELETE /stimulus(.:format) stimulus#destroy
@cpb
cpb / example.rb
Last active August 29, 2015 13:56
replace method with method object
class UserAdder < Struct.new(:user_params, :company_id, :role)
extend FriendlyMethodObject
def initialize(*)
super
# Provide defaults for optional members
self.role ||= :default_role
end
def call
@cpb
cpb / keybase.md
Created September 24, 2014 20:41
keybase.md

Keybase proof

I hereby claim:

  • I am cpb on github.
  • I am cpb (https://keybase.io/cpb) on keybase.
  • I have a public key whose fingerprint is 9BDE 4F05 5492 5FAB CC90 A66D 6AEA 78DE FAAE D9FD

To claim this, I am signing this object:

@cpb
cpb / -
Created October 8, 2014 18:39
rbenv install jruby-9000-dev 2 ↵
Downloading jruby-dist-9000.dev-bin.tar.gz...
-> http://ci.jruby.org/snapshots/master/jruby-dist-9000.dev-bin.tar.gz
error: failed to download jruby-9000.dev-SNAPSHOT.tar.gz
BUILD FAILED (OS X 10.9.5 using ruby-build 20140926)
NativeException:
java.io.IOException: exception encrypting data - java.security.InvalidKeyException: Illegal key size
org.bouncycastle.jce.provider.JDKPKCS12KeyStore:-1:in `wrapKey'
org.bouncycastle.jce.provider.JDKPKCS12KeyStore:-1:in `doStore'
org.bouncycastle.jce.provider.JDKPKCS12KeyStore:-1:in `engineStore'
java/security/KeyStore.java:1117:in `store'
@cpb
cpb / gist:1988988
Created March 6, 2012 21:10
Bookmarklet for Webkit Browsers to make GitHub Pull Requests full screen
javascript:["#slider .frames .frame",".mini-avatar-bubble",".line-comments .clipper",".site", ".site .container","#files_bucket",".discussion-timeline"].forEach(function(i) { try { var set=document.querySelectorAll(i); for(var e=0; e<set.length; e++) {set[e].style.setProperty('width','auto');} } catch(e) { console.log(e) } });[".site"].forEach(function(i) { try { document.querySelector(i).style.setProperty('margin-left','31px'); } catch(e) { console.log(e) } })
ssh az-staging "cd current ; RAILS_ENV=staging bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
# Result : /usr/lib64/rubyee/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
ssh az-prod-web1 "cd current ; RAILS_ENV=production bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
# Result : /usr/lib64/rubyee/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
ssh az-prod-web2 "cd current ; RAILS_ENV=production bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
ssh az-staging "cd current ; RAILS_ENV=staging bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
# Result : /usr/lib64/rubyee/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
ssh az-prod-web1 "cd current ; RAILS_ENV=production bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
# Result : /usr/lib64/rubyee/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
ssh az-prod-web2 "cd current ; RAILS_ENV=production bundle exec rails runner 'puts open(URI.parse(\"https://google.com\"))'"
MOBILE DEFENSE !!! curl -X POST -H "MD-TIMESTAMP:2012-03-28T01:24:59Z" -H "Content-Type:multipart/form-data" -H "MD-CLIENT-ID:lk1Oy3mPMXwp7jPO3yw6NobTpoRhLJsRiPmhGnQz" -H "MD-REQUEST-DIGEST:f4c220ec3aa74ffc5f01ace53cc65f2a42c56e3e856b01054ab88f0c64adb1d4" -F "app[binary]=@/home/partnerpedia/fake_malware.apk" https://staging.mobiledefense.com/api/v1/apps
MOBILE DEFENSE !!! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
MOBILE DEFENSE !!! "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
MOBILE DEFENSE !!!
MOBILE DEFENSE !!! <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
MOBILE DEFENSE !!!
MOBILE DEFENSE !!! <head>
MOBILE DEFENSE !!! <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
MOBILE DEFENSE !!! <title>We're sorry, but something went wrong (500)</title>
MOBILE DEFENSE !!! <style type="text/css">
@cpb
cpb / gist:2598666
Created May 5, 2012 00:14
On Actors
cbuxton:
In light of news about vert.x and local Scala meetup talks about akka and play (not fully attended by my colleagues) we're often discussing Actors. We wonder: "why would we want to use them?" and speculate at the complexity cost of developing with them. What is the expected level reuse of Actors? What is the developer burden for creating Actors? Does that cost make it easy or hard to avoid coupling actors together? Or does it make it easier or harder to limit the npath complexity of Actors?
Ultimately I think we need to try it to find out.
In the meantime, we're going to watch: http://channel9.msdn.com/Shows/Going+Deep/Hewitt-Meijer-and-Szyperski-The-Actor-Model-everything-you-wanted-to-know-but-were-afraid-to-ask
tarcieri:
Celluloid is a bit more than just actors, it provides concurrent objects that are based on the actor model
actor-based concurrent objects were a hot research topic in the early '90s
in general actors let you break apart complex event loops like you'd see in vert.x or node.js or