This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path_sub, path_beg, path_end are the ones I'll likely want to use again. | |
# ACL Docs: https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.1 | |
acl sync_req path_sub config_settings | |
redirect prefix https://artisantools.com if sync_req |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull all keys matching wildcard from your Replica so you're not using KEYS on your primary. | |
$ redis-cli -h $ELASTI_CACHE_REPLICA_URL KEYS "*WILDCARD*" > keys.txt | |
# For each key that has been collected, prepend the DEL command. | |
$ sed ':a;N;$!ba;s/\n/\n DEL /g' keys.txt > del_keys.txt | |
# Feed the new DEL commands into your primary. Run via nohup + background as deleting millions of keys can take hours. | |
$ nohup redis-cli -h $ELASTI_CACHE_URL < del_keys.txt & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
teachers:[ | |
{ | |
id:"6504b6d64d61743f7c000000", | |
type:"Teacher" | |
} | |
], | |
students:[ | |
{ | |
id:"2905b6d64d61743f7c030000", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If using rails: Place the csrf_meta_tag helper in primary layout in the head tag: | |
// = csrf_meta_tag | |
// Initializer | |
// Include the CSRF Token in each ajax Request. | |
Ember.$.ajaxSetup({ | |
headers: { | |
'X-CSRF-Token': Ember.$('meta[name="csrf-token"]').attr('content') | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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| |