Skip to content

Instantly share code, notes, and snippets.

View martinstannard's full-sized avatar
🏠
working from home

Martin Stannard martinstannard

🏠
working from home
View GitHub Profile
it "requires http basic_auth" do
@credentials = ActionController::HttpAuthentication::Basic.encode_credentials("login", "password")
request.env['HTTP_AUTHORIZATION'] = @credentials
get 'index'
# specs here
end
$(document).ready(function() {
// Creates canvas 320 × 200 at 10, 50
var rects = new Array();
var data = [10, 20, 30, 40, 50, 60];
console.log(data.length);
var paper = Raphael(10, 50, 640, 480);
var i = 0;
for (i = 0; i < data.length; i++) {
// Creates starting rects
var rect = paper.rect(0, i*30, 10, 25);
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/adapters/data_objects_adapter.rb:92:in `execute_non_query': (mysql_errno=1064, sql_state=42000) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, `branch` VARCHAR(50) DEFAULT 'master', `command` VARCHAR(50) DEFAU' at line 1 (MysqlError)
Query: CREATE TABLE `integrity_projects` (`id` serial PRIMARY KEY, `name` VARCHAR(50), `permalink` VARCHAR(50), `uri` VARCHAR DEFAULT NULL, `branch` VARCHAR(50) DEFAULT 'master', `command` VARCHAR(50) DEFAULT 'rake', `public` TINYINT DEFAULT 1, `building` TINYINT DEFAULT 0, `created_at` DATETIME, `updated_at` DATETIME, `build_id` INT(11), `notifier_id` INT(11)) from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/adapters/data_objects_adapter.rb:92:in `execute'
mstannard ~/c/dukejour /master $ rake dukejour:discover
(in /Users/mstannard/code/dukejour)
iTunes is not running!
# started iTunes
mstannard ~/c/dukejour /master $ rake dukejour:discover
(in /Users/mstannard/code/dukejour)
Adding library Jude?s Library
Done.
# launch control script for nginx on osx
# place in /System/Library/LaunchDaemons/nginx.plist
# then run "launchctl load -F /System/Library/LaunchDaemons/nginx.plist"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>nginx</string>
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
> compass --rails .
> cat .gems
formtastic
compass
# i had haml in .gems previously and it was causing a conflict
> git push heroku master
# Get access to a Library object by locale, always scope by Locale
# A library object gives us conveneince methods to access
# books, authors, fiction and non-fiction book code indeicies by locale.
# The files that drive these indices are located in blake/data/models/db/library/[product]/[subject-index].yml
library = BlakeDataModels::Library.new(locale: 'au', name: 'reading_eggspress')
# What series are available in the locale's library?
library.series_names # Generates array ["abc", "blake_novels", "boffin_boy", "brainwaves", ...]
@martinstannard
martinstannard / gist:2c633b92854984b0fcb3
Created August 19, 2014 04:38
ember.js phoenix framework channel
# ember-cli
# chat router
`import Ember from 'ember'`
ChatRoute = Ember.Route.extend
setupController: (controller, model)->
@_super(controller, model)
@martinstannard
martinstannard / gist:2f9b463e695327bc56e1
Created August 19, 2014 04:42
Phoenix for ember.js channel integration
# room_channel.ex
defmodule Stadium.RoomChannel do
use Phoenix.Channel
def join(socket, "lobby", _) do
reply socket, "joined", "you joined"
{:ok, socket}
end