(1..10).each do |n|
puts "#{n}!!"
end
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 | |
require 'date' | |
exit if `which brew`.empty? | |
last_update = DateTime.parse(File.stat(`brew --repository`.strip + '/.git').mtime.to_s) | |
days = (DateTime.now - last_update).to_i | |
if days >= 3 |
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 expr = function expr(x) { | |
return function (op) { | |
return ({ | |
'+': function (y) { return expr(x + y); }, | |
'-': function (y) { return expr(x - y); }, | |
'*': function (y) { return expr(x * y); }, | |
'/': function (y) { return expr(x / y); }, | |
'=': x, | |
})[op]; | |
}; |
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
angular.module('classyExtends', ['classy-core']).classy.plugin.controller | |
name: 'classyExtends' | |
classObjs: {} | |
waitingClassConstructors: {} | |
options: | |
enabled: true | |
convertInject: (classObj) -> |
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
angular.module('App') | |
.config ['$provide', ($provide) -> | |
$provide.decorator 'includedByStateFilter', [ \ | |
'$delegate', '$state', \ | |
($delegate, $state) -> | |
origFilter = $delegate | |
filter = (state) -> | |
if _.isArray state |
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
angular.module 'App' | |
.filter 'in', -> (obj, array) -> array.indexOf(obj) != -1 |
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 | |
# | |
# Usage: | |
# | |
# ruby pomodoro.rb # => 25 minutes timer | |
# ruby pomodoro.rb break # => 5 minutes timer | |
# ruby pomodoro.rb long-break # => 15 minutes timer | |
# ruby pomodoro.rb 20 # => 20 minutes timer | |
# ruby pomodoro.rb 10:30 # => 20 minutes and 30 seconds timer |
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
class Issue < ActiveRecord::Base | |
module STATUSES | |
OPEN = 1 | |
IN_PROGRESS = 2 | |
RESOLVED = 3 | |
CLOSED = 4 | |
end | |
STATUSES.constants.each do |name| | |
class_eval <<-CODE, __FILE__, __LINE__ + 1 |
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
class Object | |
def tap_if | |
yield(self) | |
self | |
end | |
def else | |
self | |
end | |
end |
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 slice = Array.prototype.slice; | |
var push = Array.prototype.push; | |
var inlineTags = [ | |
'input', | |
'br', | |
]; | |
var entities = { | |
'&': '&', |
OlderNewer