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 Counter | |
def initialize | |
@counter = "0" | |
end | |
def hit | |
@counter.replace( increment_string( @counter ) ); @counter.dup | |
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
module Jekyll | |
module PrettyJsonFilter | |
def pretty_json(input) | |
begin | |
JSON.pretty_generate(input) | |
rescue JSON::GeneratorError => e | |
"Error: #{e}." | |
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
def solution(a) | |
n = a.length | |
r = (1 .. n).to_a | |
diff = r - a | |
if diff.empty? | |
return n+1 | |
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
#include <random> | |
#include <iostream> | |
#define START_CREDITS 1000 | |
#define PROGRESSION_RATION 2 | |
#define MINIMAL_BET 0.5 | |
bool is_odd(int result) | |
{ | |
return result % 2 == 1; |
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
function curry(fn) { | |
const arity = fn.length; | |
const curring = function() { | |
var args = asArray(arguments); | |
if (args.length >= arity) { | |
return fn(... args); |
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
const list = ['m', 'c', 'k', 'o', 'm', 'o'] | |
const reverse = (list) => { | |
if (list.length == 0) return []; | |
let first = list.splice(0, 1); | |
return reverse(list).concat(first); | |
} |
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
const eventStub = value => ({ | |
stopPropagation: () => {}, | |
preventDefault: () => {}, | |
persist: () => {}, | |
target: { | |
value, | |
checked: value, | |
}, | |
...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
Test Suite 'All tests' started at 2017-08-20 15:59:02.890 | |
Test Suite 'AirMonitorBotPackageTests.xctest' started at 2017-08-20 15:59:02.890 | |
Test Suite 'WebhookControllerTests' started at 2017-08-20 15:59:02.890 | |
Test Case '-[AppTests.WebhookControllerTests test_get_without_verification_params]' started. | |
/Users/mckomo/Projects/AirMonitor/AirMonitorBot/Tests/AppTests/WebhookControllerTests.swift:15: error: -[AppTests.WebhookControllerTests test_get_without_verification_params] : failed - expected to equal <badRequest>, got <ok> | |
Test Case '-[AppTests.WebhookControllerTests test_get_without_verification_params]' failed (0.073 seconds). | |
Test Suite 'WebhookControllerTests' failed at 2017-08-20 15:59:02.963. | |
Executed 1 test, with 1 failure (0 unexpected) in 0.073 (0.073) seconds | |
Test Suite 'AirMonitorBotPackageTests.xctest' failed at 2017-08-20 15:59:02.963. |
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
def extract_strings(object) | |
# TODO | |
end | |
errors = { | |
options: { | |
frequency_limits: [ | |
{ | |
time_unit: [ | |
'must be one of: day, week, month' |