Skip to content

Instantly share code, notes, and snippets.

View austinbv's full-sized avatar
🎯
Focusing

Austin austinbv

🎯
Focusing
View GitHub Profile
<canvas id="drawn" height="608" width="810">
<p>
Your Browser Does Not Support HTML5 Please Upgrade for the sake of innovation
<a href="http://www.google.com/chrome">Google Chrome</a>
<a href="http://www.mozilla.com">FireFox</a>
<a href="http://www.apple.com/safari">Safari</a>
<a href="http://www.opera.com">Opera</a>
</p>
</canvas>
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
(function($) {
if ($ == null) {
$ = jQuery;
}
return $.fn.canvasize = __bind(function() {
return console.log(this);
}, this);
})($);
<canvas id="drawn" height="608" width="810">
<p>
Your Browser Does Not Support HTML5 Please Upgrade for the sake of innovation
<a href="http://www.google.com/chrome">Google Chrome</a>
<a href="http://www.mozilla.com">FireFox</a>
<a href="http://www.apple.com/safari">Safari</a>
<a href="http://www.opera.com">Opera</a>
</p>
<div id="error" class="hidden"></div>
</canvas>
class window.Presentation
constructor: ->
generateName: (length) ->
chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "T", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
str = ""
length.times ->
random = Math.floor(Math.random()*chars.length)
str += chars[random]
str
$ rspec spec/controllers/test_spec.rb
You no longer need to have jasmine.rake in your project, as it is now automatically loaded
from the Jasmine gem. To silence this warning, set "USE_JASMINE_RAKE=true" in your environment
or remove jasmine.rake.
F
Failures:
(function($) {
var methods;
if ($ == null) {
$ = jQuery;
}
methods = {
process_points: function(points) {
var level_one;
level_one = split_at_colon(points);
return split_at_comma(level_one);
describe "Draw", ->
beforeEach ->
loadFixtures("canvas.html")
# Fails with error split_at_colon is not defined
describe "points processing", ->
it "should turn comma colon seperated string into a series of 2 element arrays ", ->
processed_points = $("#drawn").test_draw('process_points', "1,1:2,2:3,3:4,4:5,5")
expect(processed_points).toEqual [[1,1],[2,2],[3,3],[4,4],[5,5]]
<p>foo<span>bar</span></p>
<div></div>
#!/bin/sh
sudo monit status | awk -F "[' ]" '/Process/ { p = $3; } /pid/ && !/parent/ { printf("%s\t%d\n", p, $NF); }' | sort > resque.log
sudo monit restart -g resque_workers
# compare first list with new list
# kill pid's if they did not change
#!/bin/bash
function kill_failed () {
sudo monit status | awk -F "[' ]" '/ pid/ { x = $NF } /status/ { if ($NF == "failed") { system("kill -9 "x);system("echo \"killing failed process \""x);exit(3)} }'
}
function start_and_wait_for_queues () {
echo "Restarting the workers"
sudo monit restart -g resque_workers
sudo monit status | awk -F "[' ]" '/ status/ { if (($NF != "running") && ($NF != "failed")) { system("sleep 15"); exit(2)} }'