Skip to content

Instantly share code, notes, and snippets.

@codekitchen
codekitchen / option1.json
Created December 28, 2011 17:52
json error response formatting options
# this is basically github's json response format
{
"message": "Validation failed.",
"errors": [
{ "field": "name", "message": "can't be blank" },
{ "field": "url", "message": "can't be blank" },
{ "field": "url", "message": "must be unique to the context" }
]
}
{
"name": [
{
"code": "blank",
"message": "can't be blank"
}
],
"shared_secret": [
{
"code": "blank",
#!/bin/bash
export RUBY_HEAP_MIN_SLOTS=500000
export RUBY_HEAP_SLOTS_INCREMENT=250000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=50000000
exec "/opt/ree/bin/ruby" "$@"
@codekitchen
codekitchen / faraday-canvas.rb
Created January 16, 2012 23:37
talking to canvas with faraday-stack
require 'faraday_stack'
conn = FaradayStack.build 'https://canvas.beta.instructure.com/'
conn.headers[:authorization] = "Bearer #{api_token}"
resp = conn.get '/api/v1/courses?include[]=syllabus_body'
puts("%-50s %s" % ['course name', 'enrollment'])
resp.body.each do |course|
puts("%-50s %s" % [course['name'], course['enrollments'].first['type']])
{"view":[{"id":16,"user_id":5,"parent_id":null,"summary":"\u003Cp\u003Ehai alert('oh noes'); hai\n\u003C/p\u003E"},{"id":30,"user_id":95,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":31,"user_id":72,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":32,"user_id":42,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":33,"user_id":27,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":34,"user_id":92,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":35,"user_id":109,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E"},{"id":36,"user_id":46,"parent_id":null,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E","replies":[{"id":37,"user_id":78,"parent_id":36,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E","replies":[{"id":39,"user_id":23,"parent_id":37,"summary":"\u003Cp\u003Ethis is a test\u003C/p\u003E","replies":[{"id":41,"user_id":108,"parent_id":3
This file has been truncated, but you can view the full file.
---
- |-
<div class="md"><p>My brother once worked at a golf course in a suburb north of Indy. One day Peyton Manning comes in and my brother starts jumping up and down to try and get his attention because Manning was thinking of just taking a cart out. Instead he takes my brother, gives him a nice tip and everything. Then one year later at a buffet at the club house Manning shows up again and as he passes my brother he goes &quot;Hey Pat&quot;.</p>
<p>Good Guy Manning Hires a random caddy at golf course one day. Still remembers his name one year later.</p>
<p>And people wonder how he can read defenses so well.</p>
</div>
- |-
<div class="md"><p>Spoiler: Pat was wearing his name tag</p>
grind:
11 lb american 2-row
2 lb roasted barley
0.5 lb acid malt
don't grind:
4 lb flaked barley
require 'rubygems'
#require 'utility_belt'
#UtilityBelt.equip(:defaults)
# grr some kind of method stomping here
def history(*args); end
def mvim
edit_interactively 'mvim -f -c "set filetype=ruby"'
#include <SDL/SDL.h>
#if EMSCRIPTEN
#include <emscripten.h>
#endif
int main(int argc, char **argv) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(40, 40, 32, SDL_SWSURFACE);
#encoding:utf-8
def i really hope this doesnt catch on(str)
puts str
end
hello world = "hello world"
i really hope this doesnt catch on(hello world)