Skip to content

Instantly share code, notes, and snippets.

View Gowiem's full-sized avatar
🌤️
Stoked on Terraforming

Matt Gowie Gowiem

🌤️
Stoked on Terraforming
View GitHub Profile
@Gowiem
Gowiem / ember_run_issue.js
Created November 28, 2013 02:15
Ember Runloop and AJAX Callbacks Issue
// Testing Helper which I use to log a user in.
// This blows up before 'student logged in' is logged
var loginStudent = function(username, password) {
visit('/').click('.studentsLogin .btn span')
.fillIn('#email-field', username)
.fillIn('#password-field', password)
.click('#login-button').then(function() {
console.log("Student logged in");
});
}
@Gowiem
Gowiem / project.json
Last active December 26, 2015 01:39
Ember.js Projects JSON
{
teachers:[
{
id:"6504b6d64d61743f7c000000",
type:"Teacher"
}
],
students:[
{
id:"2905b6d64d61743f7c030000",
@Gowiem
Gowiem / cors_closure.js
Last active December 24, 2015 10:59
Why does jQuery#getJSON work outside of this closure?
// It seems my request is fine when its not wrapped in a closure,
// but blows up with CORS errors when inside...
// The following works fine with no issues
var videoUrl = "http://vimeo.com/api/v2/video/75738368.json?callback=?"
$.getJSON(videoUrl, function (data) {
console.log("Data: ", data)
});
Hist.VideoHandler = function() {
// The following method only returns the public static variables of the View class
// when called like so:
// Class klass = android.view.View.class;
// parser.getAllFieldsForClass(klass);
public Field[] getAllFieldsForClass(Class klass) {
Field[] fields = klass.getDeclaredFields();
if (fields.length == 0) {
return new Field[0];
} else {
@Gowiem
Gowiem / hacker-news.js
Created July 3, 2013 01:01
Hacker News Voting JavaScript
function byId(id) {
return document.getElementById(id);
}
function vote(node) {
var v = node.id.split(/_/); // {'up', '123'}
var item = v[1];
// hide arrows
byId('up_' + item).style.visibility = 'hidden';
@Gowiem
Gowiem / WebsocketMonitor
Created March 21, 2013 16:31
Initializing WebSocket Manager
def initialize
puts "--Initializing Message Monitor"
EM.run {
puts "before Faye::Websocket::Client.new()"
ws = Faye::WebSocket::Client.new("wss://somewebsocket.com:/ms/monitor")
puts "After Faye::Websocket::Client.new()"
ws.onopen do |event|
puts "WebSocket Opened!"
ws.send('Hello, world!')
@Gowiem
Gowiem / vid-utility.rb
Created December 4, 2012 02:53
Ruby script to rename video files
#!/usr/bin/env ruby
# vid-utility
shows_folder = "/media/Gowie-Internal/Shared/TV-Shows/"
show_titles = %x(ls #{shows_folder}).split(/\r?\n/)
files = %x(ls)
files.each_line do |filename|
@Gowiem
Gowiem / movies.js
Created October 19, 2012 03:17
Backbone Collection.fetch problem
(function() {
define(['backbone', 'models/movie'], function(backbone, Movie, dtvCollection) {
return window.Movies = window.DTVCollection.extend({
model: Movie,
url: function() {
return this.urlRoot() + 'movies.json';
},
parse: function(response) {
console.log(response);
@Gowiem
Gowiem / flw.sh
Created October 2, 2012 19:06
Follow Script
# This is in my .bash_aliases:
alias flw="source ~/Programs/flw.sh"
# ~/Programs/flw.sh
#!/bin/bash
# Follow Script written by Matt Gowie
if [[ $2 && ${2-x} && $3 && ${3-x} ]]; then
@Gowiem
Gowiem / venues_controller.rb
Created September 10, 2012 19:48
'dump' hash into methods problem
def show
if @app_navigation == "TabBar"
first_screen = TapwalkLink.new(@app_config.menu_items[0])
redirect_to url_for(:controller => first_screen.controller, first_screen.link_params)
end
end