Skip to content

Instantly share code, notes, and snippets.

View thatkookooguy's full-sized avatar

Neil Kalman thatkookooguy

View GitHub Profile
@thatkookooguy
thatkookooguy / chocolatey-env-setup.ps1
Created February 24, 2020 17:42 — forked from amogram/chocolatey-env-setup.ps1
A Chocolatey script for PowerShell I use to set up my Windows development environment. I use this when setting up my own Dev VMs. Use at your own risk.See http://bit.ly/1a301JK and http://chocolatey.org/ for more information.
# Simple environment setup script
# Install Applications
choco install fiddler4
choco install notepadplusplus
choco install visualstudiocode
choco install greenshot
choco install GoogleChrome
choco install putty
choco install ccleaner
@thatkookooguy
thatkookooguy / osx_bootstrap.sh
Last active February 25, 2020 13:23 — forked from mrichman/osx_bootstrap.sh
Bootstrap script for setting up a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@thatkookooguy
thatkookooguy / getCallLocation.js
Last active January 27, 2020 14:20
get call location of function for tests\logs\etc.
function getCallLocation(stopStackFnName) {
stopStackFnName = stopStackFnName || 'getCallLocation';
function getErrorObject() {
try {
throw new Error('');
} catch (err) {
return err;
}
}
@thatkookooguy
thatkookooguy / test.js
Created November 27, 2019 09:29
Nice! didn't know you can do that!
let nice = 'pizza';
let bad = { [ nice ]: 'lazagna' };
console.log(bad);
// { pizza: "lazagna" }
curl -X GET \
'https://www.lens.org/lens/patent/US_2018_0112244_A1/sequences/download?si=1' \
-H 'Accept: */*' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Host: www.lens.org' \
-H 'Postman-Token: 28a6176c-d3e0-4ec1-8b1f-e7f3b9fe53db,5eb25f4d-7d60-436c-a083-49c56c7e6eaa' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'cache-control: no-cache'
@thatkookooguy
thatkookooguy / sleep-sort.js
Last active December 29, 2023 18:00 — forked from vstarck/sleep_sort.js
Sleep Sort in JavaScript | http://t.co/nWJACyK
// from: http://dis.4chan.org/read/prog/1295544154/170
function sleepSort(list, callback) {
const result = [];
list.forEach((i) => setTimeout(() => {
result.push(i);
if (result.length == list.length) {
callback(result);
}
function canEat(obj) {
obj.eat = eat;
obj.energy = 0;
function eat(energy) {
if (!this) { return; }
this.energy = this.energy || 0;
this.energy += energy;
@thatkookooguy
thatkookooguy / add-game-names.js
Last active October 2, 2018 15:44
Will add game names to the launchbox database. See comment for instructions.
javascript:(function() { $('.box-item').each(function(){ let qElm = $(this); let boxWidth = this.clientWidth; let imgWidth = qElm.find('img')[0].clientWidth; let boxHeight = this.clientHeight; let imgHeight = qElm.find('img')[0].clientHeight; let hSpace = (boxHeight - imgHeight) / 2; let wSpace = (boxWidth - imgWidth) / 2; let name = $.trim(qElm.next().find('h3').text()); qElm.append(`<div style="position: absolute;bottom: ${hSpace + 5}px;left: ${wSpace}px;right: ${wSpace}px;color: white;display: flex;align-items: center;text-align: center;justify-content: center;background: rgba(0, 0, 0, 0.5)">${name}</div>`); });})()
  • create @cliBefore(functionName) decorator. the function itself will get the @cliBeforeEach result object
  • create @cliAfter(functionName) decorator. the function itself will get the @cliAfterEach result object
  • generate a mock cli library

generate a mock cli library

This will generate an <cli_name>-mock.js library with the following methods:

  • <cli_name>-mock.inject(parentElement, onboardingFlowName) - will inject a terminal object with the onboarding flow loaded. if no onboardingFlowName is given, runs the basic mock flow (supports help output and shows general output if defined)
  • <cli_name>-mock.defineOnboarding(name, flow) - will create an onboarding flow. the flow param is an array of objects. each object is a step with the following attributes:

@beforeAll

will define a specific function that should run before actual cli functions. can be either a promise or a value return

cli-base.ts

will generate the cli by importing the given file

kb-generate-cli.js

node command line tool that will import the given file to cli-base, compile it to javascript, and install it as a global node library to allow global cli use