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
package main | |
import ( | |
"fmt" | |
) | |
func その名は(名探偵, コナン string) { | |
fmt.Println(名探偵 + "=" + コナン) | |
} |
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 SemVer | |
include Comparable | |
attr_accessor :major, :minor, :patch, :prerelease, :build_metadata | |
@@re = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?(?:\+((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?$/ | |
def initialize(major, minor, patch, prerelease = "", build_metadata = "") | |
@major = major.to_i | |
@minor = minor.to_i |
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
#!/bin/bash | |
set -eu | |
ruby -ryaml -rjson -e "puts JSON.dump(YAML.load(STDIN))" |
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
#include <iostream> | |
#include <memory> | |
std::shared_ptr<int*> CreatePointerNG(int v) { | |
auto foo = std::make_shared<int>(v); | |
return std::make_shared<int*>(foo.get()); | |
} | |
std::shared_ptr<int*> CreatePointerOK(int v) { | |
auto foo = std::make_shared<int>(v); |
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 _ = { | |
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 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 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 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 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 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 |