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 _ = { | |
| map: function(arr, fn) { | |
| var r = []; | |
| for (var i = 0, len = arr.length; i < len; i++) { | |
| r.push(fn(arr[i])); | |
| } | |
| return r; | |
| }, | |
| filter: function(arr, fn) { |
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
| import _ from "underscore"; | |
| export default function scrollfixAtBottom(opts) { | |
| opts = _.assign({ | |
| elFixed: document.querySelector(".js-scrollfix-bottom"), | |
| elRelative: document.querySelector(".js-scrollfix-bottom-rel"), | |
| bottom: 10, | |
| throttle: 50, | |
| debug: false | |
| }, opts); |
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
| <?php | |
| $num_iterates = $argv[1]; | |
| echo "iterates: $num_iterates\n"; | |
| foreach (range(1, $num_iterates) as $i) { | |
| sleep($i); | |
| echo "$i\n"; | |
| echo "ping\n"; |
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
| ruby -rjson -e 'puts "<resources>"; JSON.parse(File.read(ARGV[0]))["icons"].each {|icon| puts " <string name=\"#{ARGV[1]}_#{icon["properties"]["name"]}\">&#x#{icon["properties"]["code"].to_s(16)};</string>"}; puts "</resources>"' path/to/icomoon/selection.json prefix > path/to/values/fonts.xml |
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 StackedGraphTransformer | |
| # @param [IO] io | |
| def initialize(io) | |
| @io = io | |
| end | |
| def gets_tsv | |
| (line = @io.gets) ? line.chomp.split("\t") : nil | |
| 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
| _ = require "lodash" | |
| class BrainWrapper | |
| constructor: (@brain, @key, @initialData, @migrator = _.identity) -> | |
| get: (path = null, defaultValue = null) -> | |
| data = @_get() | |
| if path then _.get(data, path, defaultValue) else data | |
| set: (path, value) -> |
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
| require 'active_support' | |
| require 'active_support/core_ext' | |
| module Tenuki | |
| class Validator | |
| def initialize(field, value) | |
| @field = field | |
| @value = value | |
| 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
| class Foo | |
| def foo(segv?: nil, suruyo: nil) | |
| 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
| {spawnSync} = require "child_process" | |
| do -> | |
| ENV = [ | |
| "PATH" | |
| "GOPATH" | |
| ] | |
| result = spawnSync process.env.SHELL, ["-lc", "printenv"] | |
| envLines = result.stdout.toString().split("\n") |
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
| {spawn} = require "child_process" | |
| runCommand = (cmd, args, opts) -> new Promise (resolve, reject) -> | |
| p = spawn cmd, args, opts | |
| buf = [] | |
| p.stdout.on "data", (data) -> buf.push data | |
| p.stderr.on "data", (data) -> buf.push data | |
| p.on "error", reject | |
| p.on "close", (code) -> | |
| result = buf.join("").trim() |