Skip to content

Instantly share code, notes, and snippets.

View thatkookooguy's full-sized avatar

Neil Kalman thatkookooguy

View GitHub Profile

dependencies

  1. node.js
  2. brew (optional)

install

  1. run npm install -g git-stats-importer jira-cmd git-stats in your terminal
    • git-stats-importer is used to import git history into git-stats
    • git-stats is used to show your contribution graph
    • jira-cmd is used to show a specific agile board
var tbl = jQuery('.publicholidays tr').get().map(function(row) {
return jQuery(row).find('td').get().map(function(cell) {
return jQuery(cell).text();
});
}).map((holiday) => {
const regex = /\d{4}-\d{2}-\d{2}/g;
let match = regex.exec(holiday[0] || "");
let date = match ? match[0] : null;
let name = (holiday[2] || "").trim();
@thatkookooguy
thatkookooguy / sum-pipe.js
Last active January 1, 2019 23:30
an example on how to create pipe functions that behave nicely when used
function sum(initialValue) {
// we need both of these here to allow returning
// the result if no number was added
innerSum.result = initialValue;
innerSum.toString = () => innerSum.result;
return innerSum;
function innerSum(addedValue) {
innerSum.result += addedValue;
@thatkookooguy
thatkookooguy / objectMapper.js
Last active January 1, 2019 23:30
create a specific output value from any input object based on a mapper object. originally designed to allow achievibit (achievibit.kibibit.io) to work with multiple git cloud networks (GitHub, Gitlab, Bitbucket, etc.)
/**
* @fileOverview trying to create a general mapping utility.
* please credit me if you use this :-)
*
* @example
* const requestData = {
* user: 'thatkookooguy',
* project: 'achievibit',
* more: {
* user: 'ortichon'
@thatkookooguy
thatkookooguy / ubuntu-18-04-changes.md
Last active June 5, 2018 12:00
this is how I made my ubuntu 18.04 look like I want it to

prep

Need the following:

make beautiful:

  • Set the following themes:
@thatkookooguy
thatkookooguy / ubuntu8FreshInstall.sh
Last active June 10, 2018 16:10
ubuntu 18.04 fresh install script
#!/bin/bash
# Define colors if needed
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"

@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

  • 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:
@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>`); });})()
function canEat(obj) {
obj.eat = eat;
obj.energy = 0;
function eat(energy) {
if (!this) { return; }
this.energy = this.energy || 0;
this.energy += energy;