This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
| diff --git a/activesupport/lib/active_support/core_ext/array/grouping.rb b/activesupport/lib/active_support/core_ext/array/grouping.rb | |
| index 4cd9bfa..b6ccef5 100644 | |
| --- a/activesupport/lib/active_support/core_ext/array/grouping.rb | |
| +++ b/activesupport/lib/active_support/core_ext/array/grouping.rb | |
| @@ -97,4 +97,16 @@ class Array | |
| results | |
| end | |
| end | |
| + | |
| + |
This file contains hidden or 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
| { | |
| "version": "1.0", | |
| "encoding": "UTF-8", | |
| "entry": { | |
| "xmlns": "http://www.w3.org/2005/Atom", | |
| "xmlns$media": "http://search.yahoo.com/mrss/", | |
| "xmlns$gd": "http://schemas.google.com/g/2005", | |
| "xmlns$yt": "http://gdata.youtube.com/schemas/2007", | |
| "gd$etag": "W/\"DEMFR347eCp7ImA9WhZVFkQ.\"", | |
| "id": { |
This file contains hidden or 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
| Training Load (0.2ms) SELECT `trainings`.* FROM `trainings` WHERE ((begin_at <= '2011-06-15 09:00:00' AND '2011-06-15 09:00:00' <= finish_at) | |
| OR (begin_at <= '2011-06-15 11:00:00' AND '2011-06-15 11:00:00' <= finish_at)) | |
| Training Load (0.2ms) SELECT `trainings`.* FROM `trainings` WHERE `trainings`.`trainer_id` = 3 |
This file contains hidden or 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
| ig | |
| .module('game.entities.levelchange') | |
| .requires('impact.entity') | |
| .defines -> | |
| window.EntityLevelchange = ig.Entity.extend | |
| _wmDrawBox: true | |
| _wmBoxColor: 'rgba(0, 0, 255, 0.7)' | |
| size: | |
| x: 8 |
OlderNewer