Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@graemeboyd
graemeboyd / QueriesController.rb
Created October 18, 2017 21:24
Example ruby graphql controller
FloatAppSchema = GraphQL::Schema.define(
query: QueryType, // instance of GraphQL::ObjectType
mutation: MutationType // instance of GraphQL::ObjectType
)
class QueriesController < ApplicationController
include Skylight::Helpers
def create
query_string = params[:query]
Pairs of sets on dates = [[128, "2017-01-01"],[128, "2017-02-01"],[128, "2017-03-01"],[128, "2017-04-01"],[128, "2017-05-01"],
[256, "2017-06-01"],[256, "2017-07-01"],[256, "2017-08-01"],[256, "2017-09-01"],[256, "2017-10-01"]]
| id | set_id | date |
| 1 | 128 | "2017-01-01"|
| 2 | 128 | "2017-02-01"|
| 3 | 128 | "2017-03-01"|
| 4 | 128 | "2017-04-01"|
| 5 | 128 | "2017-05-01"|
| 6 | 128 | "2017-06-01"|
@graemeboyd
graemeboyd / gist:cc6f4a325283b8ef03d9
Created November 4, 2015 15:01
Dump Heroku database structure and schema
# Sleep 5 tries to avoid Heroku truncating the output by terminating the connection before everything has transferred.
# Dump structure.sql as heroku_structure.sql
heroku run 'bundle exec rake db:structure:dump && cat db/structure.sql && sleep 5' --app app-name > db/heroku_structure.sql
# Dump schema.rb as heroku_schema.db
heroku run 'bundle exec rake db:schema:dump && cat db/schema.rb && sleep 5' --app app-name > db/heroku_schema.rb
@graemeboyd
graemeboyd / browser-support.scss
Last active October 1, 2015 09:35
Choosing the source urls for a set of font formats in SASS
$support-ie8: true !default;
$use-opentype: true !default;
// A function to return a list of values associated with a list of keys
@function map-select-values($map, $selection) {
$values: ();
@each $key in $selection {
$values: append($values, map-get($map, $key));
}
@return $values;
@graemeboyd
graemeboyd / 0-readme.md
Last active December 31, 2015 20:39 — forked from burke/0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.