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 url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png |
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
function setSensitivity(element: HTMLElement, callback: () => void, timeout: number = 500): void { | |
let sensitivityTimer: number; | |
element | |
.addEventListener('mousedown', () => { | |
sensitivityTimer = setTimeout(callback, timeout); | |
}); | |
element | |
.addEventListener('mouseup', () => { |
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
<head> | |
<meta charset="utf-8"> | |
<script> | |
const notes = [ | |
'<note applicature="left">♪</note>', | |
'<note applicature="kick">♪</note>', | |
'<pause>.</pause>' | |
]; |
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
notes = %w[♪ .] | |
4.times do | |
3.times do | |
measures = [] | |
4.times do | |
measures.push "#{notes.sample}.#{notes.sample} #{notes.sample}.#{notes.sample} #{notes.sample}.#{notes.sample} #{notes.sample}.#{notes.sample} | " | |
end | |
puts measures.join | |
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
# frozen_string_literal: true | |
url_string = 'https://example.com/foo' | |
url_object = URI url_string | |
# false | |
puts case url_object | |
when %r{^https://example\.com} | |
true | |
else |
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
def print string | |
puts string | |
end | |
def to string | |
string | |
end | |
def console string | |
string |
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
# frozen_string_literal: true | |
# Numeric | |
class Numeric | |
# convert numeric (integer or float) | |
# to formatted string with cash unit | |
# | |
# @example | |
# 42_000.to_cash '$', ',', '.', '%<unit>s%<amount>.2f' # => $42.000,00 | |
# 42_000.42.to_cash 'RUB', ',', ' ', '%<amount>.2f %<unit>s' # => 42 000,42 RUB |
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
# http-cookie need for Max-Age | |
# @see https://github.com/nahi/httpclient/issues/242#issuecomment-69020815 | |
require 'http-cookie' | |
require 'httpclient' | |
require 'json' | |
require 'symbolize_keys_recursively' | |
# CallTools | |
module CallTools | |
# CallTools API Client |
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
# execute yield or not | |
# @return [Mixed] | |
# @example coin { Hamlet.new.to_be } | |
def coin | |
yield if [true, false].sample | |
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
Number.prototype.times = function (cb) { for (var i = 0; i < +this; i++) {cb(i)} } | |
function sleep(ms) {var date = Date.now(); while (Date.now() - date < 1000*ms) {} } | |
/* example use/* | |
10..times(function(i){sleep(1); console.log(i);}) |
NewerOlder