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
const path = require('path'); | |
const fs = require('fs'); | |
const csvToJson = csv => { | |
const [keys, ...rows] = csv | |
.split("\n") | |
.map(row => row.split(",")) | |
.slice(0, -1); | |
return rows.map(row => | |
row.reduce( |
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
const { execSync: exec } = require('child_process'); | |
/** | |
Executes multiple lines of script. | |
@param {String} scriptStr - A single or multi-line string of executable code | |
@example | |
execute(` | |
echo 'Hello' | |
echo 'World' | |
echo '!' |
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
/* | |
* An array is called zero-balanced if its elements sum to 0 and for each positive element n, | |
* there exists another element that is the negative of n. Write a function named ìsZeroBalanced that returns true | |
* if its argument is zero-balanced array, else return false. Note that an empty array will not sum to zero. | |
*/ | |
function isZeroBalanced(a){ | |
return a.length > 0 && a.every(x => a.includes(-x)) && a.reduce((acc, x) => acc + x) === 0 | |
} |
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
//add menu called "Extras" with a sort button | |
function onOpen(e) { | |
SpreadsheetApp.getUi() | |
.createMenu("Extras") | |
.addItem("Sort by LOC", 'sortRange') | |
.addToUi(); | |
} |
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 Game | |
attr_accessor :players, :round, :counter | |
def initialize | |
@players = Player.all | |
@round = 1 | |
@counter = 0 | |
end | |
def next_round |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |