π΅
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 gulp = require('gulp'); | |
var exec = require('child_process').exec; | |
var cmakeCommand = "mkdir -p build; cd build; cmake ..;"; | |
var cleanCommand = "rm -rf build"; | |
var testCommand = "cd build; ctest -V"; | |
//"cmake --build ." |
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
/** | |
* Validate brackets | |
* write a function that accepts a string and validates braces/brackets/parentheses | |
* β(β, β{β, β[β are openers | |
* β)β, β}β, β]β closers | |
* β{ [ }β should return false | |
* β{ [ ] ( ) }β should return true | |
**/ | |
const signMap = { |
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 getRandomIntInclusive (min, max) { | |
min = Math.ceil(min) | |
max = Math.floor(max) | |
return Math.floor(Math.random() * (max - min + 1)) + min | |
} | |
async function codeGenerator (input) { | |
const inputLengthLimit = 5 |
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 objectDiff (object, newObject, exclude) { | |
const result = {} | |
if (!exclude) { | |
exclude = [] | |
} | |
for (const prop in newObject) { | |
if (newObject.hasOwnProperty(prop) && prop != '__proto__' && exclude.indexOf(newObject[prop]) == -1) { | |
if ( |
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 routeMap = [ | |
{ from: "A", to: "B", cost: 1 }, | |
{ from: "A", to: "C", cost: 4 }, | |
{ from: "A", to: "D", cost: 10 }, | |
{ from: "B", to: "E", cost: 3 }, | |
{ from: "C", to: "D", cost: 4 }, | |
{ from: "C", to: "F", cost: 2 }, | |
{ from: "D", to: "E", cost: 1 }, | |
{ from: "E", to: "B", cost: 3 }, | |
{ from: "E", to: "A", cost: 2 }, |
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
/* | |
copy the following script in the browser on tinder page. | |
and then run the following method. | |
$ start(300) | |
*/ | |
function likeIt () { | |
document.querySelectorAll('button[aria-label="Like"]')[0].click() | |
} | |
function start (likeTime = 1000) { |
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
window.startLiking = true | |
function getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
function getRandomTime(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |
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
2.hours.ago # => Fri, 02 Mar 2012 20:04:47 JST +09:00 | |
1.day.from_now # => Fri, 03 Mar 2012 22:04:47 JST +09:00 | |
Date.today.to_time_in_current_zone # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Date.current # => Fri, 02 Mar | |
Time.zone.parse("2012-03-02 16:05:37") # => Fri, 02 Mar 2012 16:05:37 JST +09:00 | |
Time.zone.now # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Time.current # Same thing but shorter. (Thank you Lukas Sarnacki pointing this out.) | |
Time.zone.today # If you really can't have a Time or DateTime for some reason | |
Time.zone.now.utc.iso8601 # When supliyng an API (you can actually skip .zone here, but I find it better to always use it, than miss it when it's needed) | |
Time.strptime(time_string, '%Y-%m-%dT%H:%M:%S%z').in_time_zone(Time.zone) # If you can't use Time#parse |
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.exports.add = function(a, b) { | |
return a + b | |
} |
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.exports.scenario = function() { | |
let runCycles = totalExecutionLimit // 1,000,000,000 | |
setInitialTime() | |
for (;;) { | |
// do the calculation | |
add(2, 2) | |
if (!runCycles--) | |
break |