Skip to content

Instantly share code, notes, and snippets.

View jwulf's full-sized avatar
:octocat:
Coding on Halmak

Josh Wulf jwulf

:octocat:
Coding on Halmak
View GitHub Profile
version: '2'
services:
db:
image: oscarfonts/h2
container_name: zeebe_db
ports:
- "1521:1521"
- "81:81"
networks:
{
"compilerOptions": {
/* Basic Options */
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
@jwulf
jwulf / empty.js
Created April 7, 2018 03:10
How to test if a variable is empty - including an empty object or empty array
function empty(data)
{
if(typeof(data) == 'number' || typeof(data) == 'boolean')
{
return false;
}
if(typeof(data) == 'undefined' || data === null)
{
return true;
}
@jwulf
jwulf / createMathOperation.js
Created March 6, 2018 22:29
Lodash's createMathOperation in ES6
import baseToNumber from './baseToNumber.js'
import baseToString from './baseToString.js'
/**
* Creates a function that performs a mathematical operation on two values.
*
* @private
* @param {Function} operator The function to perform the operation.
* @param {number} [defaultValue] The value used for `undefined` arguments.
* @returns {Function} Returns the new mathematical operation function.
@jwulf
jwulf / add.js
Created March 6, 2018 22:23
Lodash add in ES5
var createMathOperation = require('./_createMathOperation');
var add = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
module.exports = add;
@jwulf
jwulf / add.js
Created March 6, 2018 22:22
Lodash add.js in ES6
import createMathOperation from './.internal/createMathOperation.js'
/**
* Adds two numbers.
*
* @since 3.4.0
* @category Math
* @param {number} augend The first number in an addition.
* @param {number} addend The second number in an addition.
* @returns {number} Returns the total.
* @example
const magik = magikcraft.io;
function zombie(target: string){
const EntityType = magik.type("entity.EntityType");
const aZombie = EntityType['ZOMBIE'];
const where = magik.aspecto();
const world = where.getWorld();
const zombie = world.spawnEntity(where, aZombie);
@jwulf
jwulf / write.ts
Last active December 19, 2017 12:08
Save this as a spell in Magikcraft - play.magikcraft.io
const magik = magikcraft.io;
/*
Fonts are bitmaps.
Each number is the decimal equivalent of the binary
bitmap of the line, for example: 00011000 = 24
Here is a bitmapped 'A':
00011000 = 24
00111100 = 60
00100100 = 36
@jwulf
jwulf / array-from.js
Created December 17, 2017 04:20
Array.from Polyfill function
// Production steps of ECMA-262, Edition 6, 22.1.2.1
function arrayFrom() {
var toStr = Object.prototype.toString;
var isCallable = function (fn) {
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
};
var toInteger = function (value) {
var number = Number(value);
if (isNaN(number)) { return 0; }
if (number === 0 || !isFinite(number)) { return number; }
@jwulf
jwulf / cam_replay.ts
Created December 10, 2017 15:07
Replay your movement in Minecraft using Magikcraft
/**
* Replay a sequence recorded with cam_capture.
* Optionally takes a playback speed, for example:
* /cast cam_replay(2) for 2x playback.
* Cast cam_replay while it is replaying to halt playback.
*/
const magik = magikcraft.io;
magik.dixit('Replaying...');