Skip to content

Instantly share code, notes, and snippets.

View TravisMullen's full-sized avatar

Travis Mullen TravisMullen

View GitHub Profile
@TravisMullen
TravisMullen / colors.hex.json
Created August 28, 2019 23:58
Hex Color Jawns
[{"value":"BADA55","name":"BADASS"},{"value":"C00C00","name":"COOCOO"},{"value":"D3F3C8","name":"DEFECATE"},{"value":"ACAC1A","name":"ACACIA"},{"value":"C0FFEE","name":"COFFEE"},{"value":"D31373","name":"DELETE"},{"value":"F4C4D3","name":"FACADE"},{"value":"DE1E7E","name":"DELETE"},{"value":"C0FF33","name":"COFFEE"},{"value":"D31E7E","name":"DELETE"},{"value":"BA6315","name":"BAGELS"},{"value":"D4D","name":"DAD"},{"value":"846315","name":"BAGELS"},{"value":"4C4C14","name":"ACACIA"},{"value":"104D3D","name":"LOADED"},{"value":"10ADED","name":"LOADED"},{"value":"60061E","name":"GOOGLE"},{"value":"FACADE","name":"FACADE"},{"value":"AD0BE5","name":"ADOBES"},{"value":"4D0835","name":"ADOBES"},{"value":"84D455","name":"BADASS"},{"value":"0FF1C3","name":"OFFICE"},{"value":"DAD","name":"DAD"},{"value":"ACCE55","name":"ACCESS"},{"value":"4CC355","name":"ACCESS"},{"value":"BA6E15","name":"BAGELS"},{"value":"BABE15","name":"BABELS"},{"value":"C0D3C5","name":"CODECS"},{"value":"D3C0D3","name":"DECODE"},{"value":"D05A6E",
@TravisMullen
TravisMullen / dump_ip.sh
Last active August 25, 2019 18:22
Get IP and MAC Addy from *unix
#!/bin/bash
LIMIT=90 # wait 90 increments
a=0
# wait until network has connection (eval to 0 when connected)
while ! ifconfig en0 | grep -F 'inet' > /dev/null; do
a=$(($a+1))
if [ "$a" -ge "$LIMIT" ]; then
echo "No network connection found after $LIMIT seconds, killing process."
exit 0
@TravisMullen
TravisMullen / build.scss-namespace.js
Created May 9, 2019 17:44
Design System Prefix. For use as namespace to implement style encapsulation (by class), and target custom elements.
const {
writeFileSync
} = require('fs')
const { name } = require('../package.json')
const CSSVarName = 'namespace'
if (!process.argv[2]) {
@TravisMullen
TravisMullen / main.cpp
Last active April 24, 2020 06:21
C++ Cheat Sheet by Example
// ---------- C++ Tutorial Example 1 ----------
// Source {@link http://www.newthinktank.com/2018/03/c-tutorial-26/}
/*
* Multi-line Comment
*/
// These are called preprocessor directives
// They load the files which contain premade functions
// for your use
pragma solidity ^0.4.19;
// CryptoRoulette
//
// Guess the number secretly stored in the blockchain and win the whole contract balance!
// A new number is randomly chosen after each try.
//
// To play, call the play() method with the guessed number (1-20). Bet price: 0.1 ether
contract CryptoRoulette {
@TravisMullen
TravisMullen / utils.js
Last active April 11, 2019 01:07
Useful Util function for everyday life.
/**
* File size formatting.
*
* @param bytes
* @returns {*}
* @private
*/
const _sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
export const bytesToSize = bytes => {
@TravisMullen
TravisMullen / CustomElement.vue
Created March 25, 2019 22:49
Loading a custom element from NPM into a Vue component.
<template lang="pug">
.custom-elements
// -- use HTML pre-processor for cleaner and less code/whitespace
code Hello World
br
demo-stage(
:headline='headline',
:color='color'
)
// -- assume these style classes are part of a greater design system.
@TravisMullen
TravisMullen / log.js
Last active March 26, 2019 23:06
Color logs.
import { inspect } from 'util'
const defaultOptions = { colors: true, compact: false, depth: 5, breakLength: 80 }
function verboseLogger (obj, options = {}) {
console.log(inspect(obj, Object.assign({}, defaultOptions, options)))
}
export { verboseLogger as log }
@TravisMullen
TravisMullen / js-ext.loader.mjs
Last active October 10, 2019 00:39
Loader for Node ESM support.
import path from 'path'
import process from 'process'
import Module from 'module'
/**
*
* # Experimental Modules Loader
*
* @see {@link https://nodejs.org/api/esm.html#esm_loader_hooks}
*
@TravisMullen
TravisMullen / cipher-block-chaining.js
Last active March 15, 2019 20:47
AES - Cipher Block Chaining (CBC) - 192 bit
const { randomFill, createCipheriv, createDecipheriv } = require('crypto')
const algorithm = 'aes-192-cbc'
/**
* Nonce ================
*/
const _dirtyNonce = {}
/** dirtyNonce - used none. */