Skip to content

Instantly share code, notes, and snippets.

View ivanvanderbyl's full-sized avatar
🏔️

Ivan Vanderbyl ivanvanderbyl

🏔️
View GitHub Profile
@ivanvanderbyl
ivanvanderbyl / account_routes.js
Last active January 31, 2016 17:55
Using Ember initializers and injections to setup the `currentUser` within your app.
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
@ivanvanderbyl
ivanvanderbyl / post_view.hbs
Last active September 23, 2016 15:16
A simple Handlebars helper to do automatically updating dates. Requires moment.js
<time>{{timeAgoInWords post.publishedAt}}</time>
@ivanvanderbyl
ivanvanderbyl / gist:4222308
Created December 6, 2012 06:55
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
@ivanvanderbyl
ivanvanderbyl / ember-data.js
Created December 4, 2012 23:59
Ember Data compiled @ 796cc1920f53dbe858430cb142f7432f32251f06
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 10
});
})();
(function() {
load 'deploy/assets'
set :bundle_roles, [:app] #{:except => {:no_release => true}} # e.g. [:app, :batch]
require 'bundler/capistrano'
set :application, "my_app"
set :repository, "[email protected]:myname/#{application}.git"
set :user, 'deploy'
set :use_sudo, false
= address.input :formatted_address,
:label => "Address",
:placeholder => "e.g. Level 1, 41 Stewart Street, Somewhere, Victoria 3012",
:input_html => {:class => "location input-xlarge"}
= javascript_include_tag "//maps.googleapis.com/maps/api/js?sensor=true"
:coffeescript
geocoder = new google.maps.Geocoder()
@ivanvanderbyl
ivanvanderbyl / Readme.markdown
Created August 3, 2012 02:01
CrashLog payload structure

CrashLog events API

CrashLog accepts events over HTTP to stdin.crashlog.io. Events are authenticated with HMAC (see below) using an api_key and secret. Upon successfully authenticating the payload will be consumed.

HMAC authenticated requests

All payloads must be sent along with a HMAC Authorization header, this should be structured like this:

Authorization: CrashLog <api-token>:<HMAC Signature>

@ivanvanderbyl
ivanvanderbyl / create_jobs.rb
Created July 22, 2012 03:05
Using 128bit UUIDs with ActiveRecord
class CreateJobs < ActiveRecord::Migration
def up
create_table :jobs do |t|
t.timestamps
end
sql = <<-SQL
ALTER TABLE "jobs" ALTER COLUMN id DROP DEFAULT,
ALTER COLUMN id TYPE uuid USING uuid_generate_v4(),
ALTER COLUMN id SET DEFAULT uuid_generate_v4();
@ivanvanderbyl
ivanvanderbyl / database.yml
Created July 2, 2012 03:49
Capsitrano deploy script for deploying to an 'ivanvanderbyl:application deployed' server.
production:
adapter: postgresql
encoding: unicode
database: my_application
pool: 5
host: 127.0.0.1
@ivanvanderbyl
ivanvanderbyl / UI.ListView.js
Created June 28, 2012 02:12 — forked from guilhermeaiolfi/UI.ListView.js
ListView widget for ember.js
var get = Ember.get, set = Ember.set;
UI = {};
UI.ListView = Em.CollectionView.extend({
tagName: "ul",
viewName: 'ListViewContainer',
classNames: ["ember-listview"],
attributeBindings: ['tabindex', 'unselectable'],
unselectable: 'on',
tabindex: 0,
mode: 'single',