Skip to content

Instantly share code, notes, and snippets.

View willscripted's full-sized avatar

Will O'Brien willscripted

View GitHub Profile
@willscripted
willscripted / getopts.sh
Created February 8, 2015 13:53
playing around with getopts
#!/usr/bin/env bash
OPTIND=1 # Reset getopts iterator
while getopts "ht:f:" opt; do
case "$opt" in
h|\?)
echo "h or nothing?"
exit 0
;;
@willscripted
willscripted / csr.pem
Last active August 29, 2015 14:13
Server for testing CORS configs
-----BEGIN CERTIFICATE REQUEST-----
MIIBnzCCAQgCAQAwXzELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAwwPYmV0
YS50YXBqb3kuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDtuGIDiuI7
7W4RAc0pGwi0f906ie3zzt4zbBcrS6WHXm49TmQzd+alRS8QDKONgwKPPagmKp4Z
p00laKphVrhIkXr+hiEEoypRlhyMKVLGfpQZhIqiYbFYbs4weCHTRpTQXXfmnOCw
ZuL1jTzIvBaONwGsc1oSnXUBu4a9sfvj9QIDAQABoAAwDQYJKoZIhvcNAQELBQAD
gYEAtP/dhSOv/Fo6vVRKFiKNaqroTa6Hi//JGosm7YubX5+n4ZwVJ4bpmzcJym5n
FpuMKiXpqlNGGUQ4yEkSCkP+Ab1dnS6dAGi63wjsWeAgwAbQH0xlN4ovsJNBtHRz
SUUZdA9wOs5tBAyGrEr6mTuO/kVKd24i3E1dZtxeUZKOQlo=
sudo apt-get install libnss3-tools
certutil -d sql:.pki/nssdb -A -t "C,," -n "will-ob localhost" -i /usr/share/ca-certificates/moar/localhost.crt
sudo dpkg-reconfigure ca-certificates
@willscripted
willscripted / user_controller.rb
Created August 28, 2014 16:46
Fine-grained permissions
## e.g. Usage
def V1::UserController < V1::BaseController
## In controller
def show
render :json => reject_unpermitted(user, V1::UserPresenter.new(user))
end
def update
@willscripted
willscripted / index-page.coffee
Created July 8, 2014 17:30
Tanner look at this router
class IndexPage
constructor: (opts) ->
@view = new RactiveView(el: opts.el)
# Ask the router for current user,
# if success, set user
# if fail, redirect to login
opts.router.getCurrentUser().then (user) =>
@willscripted
willscripted / nginx-conf
Created May 1, 2014 12:08
Nginx config to do ssl termination and serve static assets. If static assets are not found, forward request to another server
upstream api {
server hopper-api.herokuapp.com;
}
server {
listen 80;
listen 443 ssl;
server_name www.schedjs.com$;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
@willscripted
willscripted / kernel
Created March 27, 2014 11:56
Because sometimes in business, your goals are tied to fiscal quarters
Linux - elitist attitude - only considers patche of real-world problems. Marketing bullets or one-off requests, such as pageable kernel memory, have received no consideration
Kernel Development
Introduction
==============
History
-----------
@willscripted
willscripted / gist:9352818
Created March 4, 2014 18:41
install node
# Node in apt is 0.6.X we want 0.10.X
sudo -E apt-get install -y python-software-properties python g++ make
sudo -E add-apt-repository -y ppa:chris-lea/node.js
sudo -E apt-get update
sudo -E apt-get install -y nodejs
@willscripted
willscripted / thing.coffee
Last active December 28, 2015 16:19
Coffee - adventure with private method binding
class Thang
class Thing extends Thang
# isPrivate must exist above use in initialize
isPrivate = ->
return @things
initialize: ->
@things = true
define [
"pages/placements/detail/segment_form"
"squire"
"marrow"
"dashboard"
"handlebars"
], (SegmentForm, Squire, Marrow, Dashboard, Handlebars) ->
perms = { canSetTestOffer: -> throw "stub" }