Skip to content

Instantly share code, notes, and snippets.

BJ Cantlupe BeejLuig

Block or report user

Report or block BeejLuig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BeejLuig
BeejLuig / execute.js
Created Jul 5, 2019
Node helper to execute multiple lines of shell script
View execute.js
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 '!'
@BeejLuig
BeejLuig / zero-balanced.js
Last active Oct 11, 2017
Zero Balanced Array
View zero-balanced.js
/*
* 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
}
@BeejLuig
BeejLuig / sort_by_call_number.js
Last active Jun 20, 2017
Google Apps Script - Sort by Call Number
View sort_by_call_number.js
//add menu called "Extras" with a sort button
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu("Extras")
.addItem("Sort by LOC", 'sortRange')
.addToUi();
}
@BeejLuig
BeejLuig / gin-rummy
Created May 28, 2017
Gin rummy score keeper CLI
View gin-rummy
class Game
attr_accessor :players, :round, :counter
def initialize
@players = Player.all
@round = 1
@counter = 0
end
def next_round
@BeejLuig
BeejLuig / 0_reuse_code.js
Created Feb 19, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.