Skip to content

Instantly share code, notes, and snippets.

View joshco's full-sized avatar

Josh joshco

  • Department of Redundancy Department
  • New York
View GitHub Profile
@joshco
joshco / gist:5439376
Created April 22, 2013 23:09
POST/Create associations in HAL
{
"_links": {
"event": {
"href": "http://localhost:3000/api/v1/events/3"
},
"person": {
"href": "http://localhost:3000/api/v1/people/2"
},
"self": {
"href": "http://localhost:3000/api/v1/rsvps/1"
@joshco
joshco / gist:0519fad6f846a6a7fcb3
Created March 9, 2015 10:04
Making a dynamic collection representer
module Api
module V1
module CollectionRepresenter
include Roar::JSON::HAL
# include Roar::Representer::Feature::Hypermedia
#pagination
def total_pages
@joshco
joshco / gist:38a9eccd103213bf747d
Created April 22, 2015 04:39
A typical set of available rake tasks
$ rake -T
DL is deprecated, please use Fiddle
rake about # List versions of all Rails framew...
rake apartment:create # Create all tenants
rake apartment:migrate # Migrate all tenants
rake apartment:migrate:down # Runs the "down" for a given migra...
rake apartment:migrate:redo # Rolls back the tenant one migrati...
rake apartment:migrate:up # Runs the "up" for a given migrati...
rake apartment:rollback # Rolls the migration back to the p...
rake apartment:seed # Seed all tenants
root@ip-10-123-195-142:/var/log/dokku/vwf# docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
8a982064be2e postgres:9.3 "/docker-entrypoint. 27 minutes ago
Up 27 minutes 5432/tcp psql-single-container
root@ip-10-123-195-142:/var/log/dokku/vwf# dokku ls
=====> App Name Container Type Container Id
tmx web 5f0392975313eecbbe8055fb7fa1ef11daa67f2cdb1f86cea5528365222e08c1
vwf jobs f687a8c04563a1e7f8194cfa257238b9e7b0953ca1cb31e0f36e2b3d162690da
@joshco
joshco / build.log
Created June 13, 2015 20:36
dockerfile fail
+ parse_args git-receive-pack ''\''pymysample'\'''
+ for arg in '"$@"'
+ case "$arg" in
+ for arg in '"$@"'
+ case "$arg" in
+ return 0
+ args=("$@")
+ [[ git-receive-pack =~ ^--.* ]]
+ has_tty
++ /usr/bin/tty
@joshco
joshco / parse_as_zone.rb
Created May 16, 2016 04:10
Parse time as in zone
def parse_as_zone(time_string, tzid)
Time.use_zone(tzid) do
Time.zone.parse(time_string)
end
end
@joshco
joshco / Guardfile.rb
Last active May 10, 2019 18:44
Vagrant Guest Guard HTTP Solution
require 'sinatra'
require 'json'
# Use of guard-yield based on wisdom from https://github.com/e2
# use of HTTP crime by @joshco
class SinatraGuard < Sinatra::Base
set :bind, '0.0.0.0'
set :port, 4000
@joshco
joshco / event.json
Last active June 12, 2017 23:02
Get record attendance helper
{
"identifiers": [
"osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
"foreign_system:1"
],
"origin_system": "OSDI Sample System",
"created_date": "2014-03-20T21:04:31Z",
"modified_date": "2014-03-20T21:04:31Z",
"name": "March 14th Rally",
"title": "Rally for Justice",
@joshco
joshco / record.json
Last active June 20, 2017 04:28
van osdi record attendance
{
"origin_system": "marriage_hero",
"van:shift": {
"shift_id": 1
},
"van:location": {
"location_id": 2
},
"van:role": {
"role_id": 3,
@joshco
joshco / individual script get
Created June 20, 2017 05:09
Scripts collection
{
"origin_system": "VAN",
"name": "osdi_script",
"description": "OSDI Test Script",
"title": "osdi_script",
"summary": "OSDI Test Script",
"status": "Active",
"identifiers": [
"VAN:235196"
],