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/ruby | |
# started at 2:29 | |
# 1 | |
test_list = [42, 512, 7, 3, 11] | |
# use builtin summing function | |
expected_value = test_list.reduce(:+) | |
def sum_for(list) |
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
var moment = require('moment'); | |
var tz = require('moment-timezone'); | |
var timePlugin = { | |
init: function (client, imports) { | |
return { | |
exports: null, | |
handlers: { | |
'!time': function (message) { | |
var timeNow = moment().tz('America/Chicago').format('ddd, h:mm A'); |
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 Dijkstra(start, finish, nodes) | |
--Create a closed and open set | |
local open = {} | |
local closed = {} | |
--Attach data to all noded without modifying them | |
local data = {} | |
for _, node in pairs(nodes) do | |
data[node] = { | |
distance = math.huge, |
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
module.exports = function (req, res, next) { | |
res.locals.flash = {}; | |
if(!req.session.flash) return next(); | |
res.locals.flash = _.clone(req.session.flash); | |
req.session.flash = {}; | |
next(); |
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
# Allow nil values but not zero length strings | |
validates_length_of :title, :minimum => 1, :allow_nil => true | |
# Allow zero length strings but not nils | |
validates_length_of :body, :minimum => 0, :allow_nil => false |
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
Hayk-Saakians-Mac:extempengine hayk$ git rebase master | |
First, rewinding head to replay your work on top of it... | |
Applying: transitioning to mongoid 3 | |
Using index info to reconstruct a base tree... | |
M Gemfile | |
M Gemfile.lock | |
<stdin>:18: trailing whitespace. | |
gem 'mongoid-locker' # | |
warning: 1 line adds whitespace errors. | |
Falling back to patching base and 3-way merge... |
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
@staticmethod | |
def get_adjacent_robots(self, game, player_comparator=None): | |
def generate(): | |
for loc,bot in game.get('robots').items(): | |
if rg.wdist(loc, self.location) <= 1: | |
if player_comparator == None or player_comparator(self.player_id, bot.player_id): | |
yield (loc, bot) | |
return dict(generate()) |
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
@testColor: #ff0000; | |
section#body_content { | |
#grid > .fluid > .row-fluid; | |
h1#body_content_title { | |
#grid > .fluid > .row-fluid; | |
color: @testColor; | |
} | |
/* section#body { | |
#grid > .fluid > .span(8); | |
} |
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
Roadie cannot use "(function( window" when inlining stylesheets | |
Roadie cannot use "undefined )" when inlining stylesheets | |
Roadie cannot use "" when inlining stylesheets | |
Roadie cannot use "// Clean-up method for dom ready events\ndetach = function()" when inlining stylesheets | |
Roadie cannot use ";\njQuery.fn = jQuery.prototype =" when inlining stylesheets | |
Roadie cannot use "return this;\n// HANDLE: $(#id)\nelse" when inlining stylesheets | |
Roadie cannot use "this.context = document;\nthis.selector = selector;\nreturn this;\n// HANDLE: $(expr" when inlining stylesheets | |
Roadie cannot use "$(...))\nelse if ( !context || context.jquery )" when inlining stylesheets | |
Roadie cannot use "// HANDLE: $(DOMElement)\nelse if ( selector.nodeType )" when inlining stylesheets | |
Roadie cannot use "else if ( jQuery.isFunction( selector ) )" when inlining stylesheets |
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
rake aborted! | |
undefined method `tzinfo' for nil:NilClass | |
(in /tmp/build_14qw7djnbp2vr/vendor/bundle/ruby/2.0.0/bundler/gems/detect_timezone_rails-ba752d91669c/vendor/assets/javascripts/jquery.detect_timezone.js.erb) | |
/tmp/build_14qw7djnbp2vr/vendor/bundle/ruby/2.0.0/bundler/gems/detect_timezone_rails-ba752d91669c/vendor/assets/javascripts/jquery.detect_timezone.js.erb:34:in `block in singleton class' | |
/tmp/build_14qw7djnbp2vr/vendor/bundle/ruby/2.0.0/bundler/gems/detect_timezone_rails-ba752d91669c/vendor/assets/javascripts/jquery.detect_timezone.js.erb:-6:in `instance_eval' | |
/tmp/build_14qw7djnbp2vr/vendor/bundle/ruby/2.0.0/bundler/gems/detect_timezone_rails-ba752d91669c/vendor/assets/javascripts/jquery.detect_timezone.js.erb:-6:in `singleton class' | |
/tmp/build_14qw7djnbp2vr/vendor/bundle/ruby/2.0.0/bundler/gems/detect_timezone_rails-ba752d91669c/vendor/assets/javascripts/jquery.detect_timezone.js.erb:-8:in `__tilt_70150981721640' | |
/tmp/build_14qw7djnbp2vr/vendor/bu |
NewerOlder