Skip to content

Instantly share code, notes, and snippets.

View dbackeus's full-sized avatar

David Backeus dbackeus

View GitHub Profile
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 file -In | grep -v binary | cut -d ":" -f1 | xargs -0 sed -i '' -E "s/[[:space:]]*$//"
@dbackeus
dbackeus / utf8_json_spec.rb
Created December 13, 2012 17:11
Spec to confirm monkey patch still necessary for: https://github.com/rails/rails/issues/3727
# Encoding: UTF-8
require 'spec_helper'
# Specs for initializers/patches.rb
describe ActiveSupport::JSON::Encoding do
it "should not break high bitrate utf-8 characters" do
hash = { string: "𐒑" }
json = ActiveSupport::JSON.encode(hash)
require 'yaml'
class Monster
def self.bestiary
@bestiary ||= YAML.load_file("monsters.yml")
end
def self.random
new bestiary.keys.sample
end
@dbackeus
dbackeus / gist:2828125
Created May 29, 2012 12:21
Intercom cross domain error
XMLHttpRequest cannot load https://api.intercom.io/api/messages/index. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
Failed to load resource: the server responded with a status of 422 (Unprocessable Entity) https://api.intercom.io/api/messages/index?app_id=wxtea8jc&email=admin%40streamio.se&user_id=4c57f3975412901427000003&user_hash=9b356512ca67ae94d038a7ea944d7d4ea42d6d0f&created_at=1338293917&custom_data=%7B%22account%22%3A%22ResqueMailerer%22%2C%22plan%22%3A%22test%22%2C%22url%22%3A%22http%3A%2F%2Flocalhost%3A3000%2Faccounts%2F4ec12b3b541290151d000004%2Fswitch%22%7D&name=Streamio%20Admin&inbox_installed=true&callback=IntercomJSONP1338293917981&_=1338293917981
@dbackeus
dbackeus / audio_public.json
Created April 30, 2012 10:03
Audio public JSON
{
"id":"4f96806c505ca25d71000001",
"title":"My Title",
"description":"A description.",
"created_at":"2012-04-02T09:28:13Z",
"updated_at":"2012-04-02T12:11:01Z",
"duration":8.41,
"plays":2,
"state":"ready",
"tags": ["awesome", "sports"],
@dbackeus
dbackeus / audios.json
Created April 30, 2012 09:58
Audio list JSON
[
[
{
"id": "4f96806c505ca25d71000001",
"title": "Catch a Cloud",
"description": "A description.",
"tags": ["some", "tags"],
"created_at": "2012-04-24T10:29:00Z",
"updated_at": "2012-12-04T08:24:51Z",
"duration": 218.47999999999999,
@dbackeus
dbackeus / audio.json
Created April 30, 2012 09:58
Audio JSON
{
"id": "4f96806c505ca25d71000001",
"title": "Catch a Cloud",
"description": "A description.",
"tags": ["some", "tags"],
"created_at": "2012-04-24T10:29:00Z",
"updated_at": "2012-12-04T08:24:51Z",
"duration": 218.47999999999999,
"plays": 2,
"state": "ready",
@dbackeus
dbackeus / player_list.json
Created November 17, 2011 14:30
Player list JSON
[
{
"id": "4ec4c600bf4b9801d3000004",
"title": "Awesome",
"width": 640,
"height": 746,
"tags": [],
"autoplay": false,
"google_analytics_property_id": null,
"playlist": true,
@dbackeus
dbackeus / player.json
Created November 17, 2011 14:26
Player JSON
{
"id": "4ec4c600bf4b9801d3000004",
"title": "Awesome",
"width": 640,
"height": 746,
"tags": [],
"autoplay": false,
"google_analytics_property_id": null,
"playlist": true,
"limit": 3,
@dbackeus
dbackeus / video_with_image.json
Created November 16, 2011 16:51
Public Video JSON with image
{
"id":"4d52bd34e42600600100008e",
"title":"Streamio 20th Century Fox Teaser",
"description":"Smooth moves hey...",
"aspect_ratio_multiplier":1.7777777777777777,
"created_at":"2011-02-09T16:13:41Z",
"updated_at":"2011-02-10T14:37:52Z",
"duration":21.9,
"plays":34,
"progress":1.0,