View chunk.js
function chunk(array, opt_size) {
opt_size = opt_size > 0 ? ~~opt_size : 1;
for (var chunks = [], i = Math.floor((array.length - 1) / opt_size) * opt_size; i >= 0; i -= opt_size) {
chunks.unshift(array.slice(i, i + opt_size));
}
return chunks;
}
//\\
nums = new Array(26).join(1).split(1).map((x, i) => i + 1);
View only.js
console.loadYourJS({ functions: ['has'] });
//\\
var { has } = YourJS;
//\\
// requires has()
function only(opt_subject, keys, opt_initial) {
function f(subject, opt_initial) {
var result = {};
View mapFilter.js
console.loadYourJS({ functions: ['forOf', 'typeOf'] });
//\\
var { forOf, typeOf } = YourJS;
//\\
// requires forOf() and typeOf()
function mapFilter(subject, mapper, opt_onlyRemoveUndefined) {
var result,
isArray = typeOf(subject).indexOf('Array') >= 0 && 'function' === typeof subject.splice,
View Example of YourJS.fullNumber.js
console.loadYourJS({ name: 'YourJS' });
// CODE BREAK \\
YourJS.fullNumber(Number.MIN_VALUE);
// CODE BREAK \\
YourJS.fullNumber(Number.MAX_VALUE);
View Better toFraction Attempt.js
function toFraction(num, opt_precision = 6) {
if (num === Math.ceil(num)) {
return [num, 1];
}
var diff, gcdHelper,
mult = num < 0 ? -1 : 1,
numerator = 1, denominator = 2,
offset = Math.floor(Math.log10(num = Math.abs(num))) + 1,
acceptableLoss = Math.pow(10, -opt_precision - 1 - offset),
View _ace-editor-vue-component.md

To use the Ace editor Vue component you must:

  • Include Vue.
  • Include Ace.
  • Include the ace-editor-vue-component.js file.
  • Create a Vue container element (eg. <div id="myVue">...</div>).
  • Create an ace editor element within the Vue container (eg. <ace-editor ...></ace-editor>).
  • In JS make the element into a Vue (eg. new Vue({ el: '#myVue' ... })).

Doing that should do the trick. Example HTML code can be found in example.html and also in https://codepen.io/cwestify/full/ajKeKX/. This solution is written up here: http://cwestblog.com/2018/08/04/ace-editor-vue-component/

View YourJS.span() Test.console.js
console.loadYourJS({ name: '_', functions: ['span'] });
// Test Out YourJS.span(...) \\
_.span(10, 100, 5);
View get-bible-stats-from-wol.jw.org.js
(function () {
var myVue;
var urlPrefix = location.hostname === 'wol.jw.org' ? '' : 'https://cors-anywhere.herokuapp.com/';
var bibles = window.__bibles__ = [];
bibles.logSummary = logSummary;
function loadScriptsIn(doc, urls, callback) {
var scriptsLeft = urls.length;
urls.forEach(function(url) {
var script = doc.createElement('script');
View get_recent_days.sql
CREATE OR REPLACE FUNCTION get_recent_days() RETURNS TABLE ("date_type" VARCHAR, "date_value" DATE, "date_sql" VARCHAR) STABLE AS $$
/*******************************************************************************
* Author: Chris West
* Date: 2018-07-24
* Source: http://cwestblog.com/2018/07/24/plpgsql-example-function-that-returns-a-table/
* Description:
* Gets all 7 previous days of the week and all 7 of the most recent days of
* the week along with the SQL that can be run to get each value.
* Example Run:
* SELECT * FROM get_recent_days();
View span.js
/**
* Creates an array with the span of numbers going from `first` and ending at
* `last` if possible depending on the specified step value.
* @param {number} first
* First number that should appear in the returned array.
* @param {number} last
* Last number that should appear in the returned array.
* @param {number=} opt_step
* Defaults to `1` if not given or if `0` or `NaN` is specified. The
* difference between each subsequent number in the returned array.