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(grunt) { | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-contrib-less'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-coffee'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); |
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
➜ Seelies git:(master) cloc app/models --by-file | |
37 text files. | |
37 unique files. | |
0 files ignored. | |
http://cloc.sourceforge.net v 1.60 T=0.09 s (428.2 files/s, 6597.3 lines/s) | |
-------------------------------------------------------------------------------------------- | |
File blank comment code | |
-------------------------------------------------------------------------------------------- | |
app/models/dispatcher.rb 15 3 49 |
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 File.expand_path('../../config/environment', __FILE__) | |
require 'thor' | |
class PlayersCommand < Thor | |
desc :add, 'Add a player with the given name.' | |
method_option :force, desc: 'Delete the player if it already exists.', type: :boolean, default: false | |
def add(name) | |
existing_player = Player.find_by_name(name) |
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
require 'spec_helper' | |
RSpec.describe Convoy do | |
it 'has wayponts' do | |
Convoyy = Struct.new(:waypoints) do | |
def replace_waypoint(old_waypoint_step_number, new_waypoints) | |
waypoints | |
.select { |waypoint| old_waypoint_step_number <= waypoint.step_number } | |
.map { |waypoint| waypoint.active = 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
class Stater | |
def initialize(*roles) | |
@state = 0 | |
@roles = roles | |
end | |
def current | |
@roles[@state % @roles.size] |
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 | |
module MinifyResources | |
CSS_BLOB = 'public/blob.css' | |
CSS_DIR = 'public/css' | |
CSS_LIST = 'public/css/manifest.txt' | |
CSS_FILES = File.exists?(CSS_LIST) ? IO.read(CSS_LIST).scan(/\S+/) : Dir.chdir(CSS_DIR){ Dir['*.css'] } | |
JS_BLOB = 'public/blob.js' | |
JS_DIR = 'public/js' |
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 body = JSON.stringify({ | |
uuid: item.uuid | |
}), | |
options = { | |
host: settings.callback.hostname, | |
port: settings.callback.port, | |
path: settings.callback.path, | |
method: 'POST', | |
headers: { | |
'X-PQS-Secret-Key': settings.callback.secretKey, |
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 settings = { | |
callback: { | |
hostname: '127.0.0.1', | |
port: 4567, | |
path: '/finish_production', | |
secretKey: 'my-super-secret-key' | |
} | |
} | |
var http = require('http'), |
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 Array | |
# Count occurences of values in the array. | |
# Return it as a hash. | |
# | |
# [1, 1, "foo", :bar, 1, :bar].count_occurrences # => {1 => 3, "foo" => 1, :bar => 2} | |
def count_occurrences | |
h = self.group_by { |x| x } | |
Hash[h.map { |k, v| [ k, v.length ] } ] | |
end | |
end |
OlderNewer