Skip to content

Instantly share code, notes, and snippets.

View jeremyckahn's full-sized avatar

Jeremy Kahn jeremyckahn

View GitHub Profile
@jeremyckahn
jeremyckahn / generateBoilerplatedKeyframes.es5.js
Created July 14, 2017 12:57
What going from ES5 to ES6 can look like
/*!
* @param {Rekapi.Actor} actor
* @param {string} animName
* @param {number} steps
* @param {boolean} doCombineProperties
* @param {Array.<string>=} opt_vendors
* @return {string}
*/
function generateBoilerplatedKeyframes (
more productive
comfortable
not drinking too much
regular exercise at the gym (3 days a week)
getting on better with your associate employee contemporaries
at ease
eating well (no more microwave dinners and saturated fats)
a patient better driver
a safer car (baby smiling in back seat)
sleeping well (no bad dreams)
@jeremyckahn
jeremyckahn / daskal.json
Last active April 18, 2017 16:05
daskal
{
"response_type": "in_channel",
"text": ":daskal: :bubble_l: Please move this to a thread! :bubble_r:"
}
export const isPalindrome = string =>
string.split('').reverse().join('') === string;
@jeremyckahn
jeremyckahn / delete-random-lines.js
Created February 14, 2017 20:48
delete-random-lines.js
// Usage:
// node delete-random-lines.js some-file.txt
require('fs').readFile(process.argv[2], 'utf-8', (err, file) => {
const lines = file.split('\n');
const linesToDelete = Math.round(lines.length * 0.1);
for (let i = 0; i < linesToDelete; i++)
lines.splice(
Math.floor(Math.random() * lines.length),
@jeremyckahn
jeremyckahn / delete-random-lines.js
Created February 14, 2017 20:24
Delete random lines in a file
// Usage:
// node delete-random-lines.js some-file.txt
const fs = require('fs');
const lines = fs.readFileSync(process.argv[2], 'utf-8').split('\n');
const lineToDelete = Math.round(lines.length * 0.1);
for (let i = 0; i < lineToDelete; i++) {
lines.splice(
@jeremyckahn
jeremyckahn / AutoloadGame.js
Created November 8, 2015 01:25
RPG Maker MV plugin to autoload a saved game when the game boots
/* globals PluginManager, SceneManager, Scene_Load, DataManager */
/*:
* @plugindesc Autoload a saved game when the game boots
* @param File ID
* @desc The 1-based index of the file to load
* @default 1
* @author Jeremy Kahn
*/
(function () {
'use strict';
@jeremyckahn
jeremyckahn / AutoStartNewGame.js
Last active September 14, 2016 21:20
RPG Maker MV plugin to auto start a new game when the game boots
/* globals SceneManager */
/*:
* @plugindesc Auto start a new game when the game boots
* @author Jeremy Kahn
*/
(function () {
function poll () {
if (SceneManager._scene && SceneManager._scene.commandNewGame) {
SceneManager._scene.commandNewGame();
} else {
@jeremyckahn
jeremyckahn / ExecScript.js
Created November 6, 2015 02:20
An RPG Maker MV plugin for easily calling JavaScript files from events
/*:
* @plugindesc A utility for easily calling JavaScript files from events
* @author Jeremy Kahn
*
* @help API: exec('path/to/script', arg1, arg2, ...);
*
* * You may add on as many arguments as you need.
* * The path is relative to project-root/js
* * Loaded files must be AMD modules that looks like so:
*
@jeremyckahn
jeremyckahn / convert_all_scss_to_sass.sh
Last active August 29, 2015 14:17
Convert all SCSS files to SASS.
for FILE in `ls`; do sass-convert $FILE > `echo $FILE | sed s/scss/sass/`; done