View _ff-addon-snippet-CreateMenuWithSubmenuAndAttachToWidget.js
function doit() {
//create and add the panel now
var doc = document;
var myWidget = doc.getElementById('widget:jid1-lwNbwJJiiMXM4A@jetpack-open-traveleye'); //we add the menu to this widget, we can add menu to anything by setting the context attribute of it to the id of the menu we want to give it
var myMenuJson =
['xul:menupopup', {id: 'myMenu1'},
['xul:menuitem', {label:'menu item1'}],
['xul:menu', {label:'menu item2 is submenu1'},
['xul:menupopup', {},
View _js-snippet-MDNBuildingDomTrees.js
function example() {
var hotkeyLabelJson =
['ul', {class: 'apple cf',id:'apple-qwerty'},
['li', {class:'apple'},
['a',{class:'nthotkey-apple-key apple-key'},
[span, {},
1
]
]
],
View _php-array-merge-ref-preservation.php
<?php
$foo = 12;
$a1 = ['foo' => &$foo];
$showa1 = function() use(&$a1) {
print_r($a1);
};
$bar = 100;
View about.md

Fork your own Gist

This is a script that adds a fully functional Fork button to your own Gist.

If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.

The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well). Meaning you will have to run the script every new page load.

Firefox

Copy the contents from bookmarklet.js, open Scracthpad (Ctrl+F4), paste it there. Back in browser, swwitch to tab with your Gist you want to fork. Back in Scratchpad, "Run" it. Save and/or bookmark the Scratchpad file for future use.

View _git-submodule-tips.md

Tips for Working With git Submodules

Cloning Repo with Submodules

Source: Stackoverflow :: Empty Git submodule folder when repo cloned
  1. Use the --recursive flag:

     git clone https://github.com/aikiframework/json.git --recursive
    

    However if you cannot, as Github desktop app on clone does not use this flag, then do this after clone:

View _js-useful.js
function isBetween(num, range) {
// returns true if number is within range
// range is array [lowernum, highernum]
let [min, max] = range;
let rez = num >= min && num <= max;
// console.log('isBetween:', rez, num, range.join('-'));
return rez;
}
function isOverlap(range1, range2) {
// depends on isBetween
View _js-primesBetween.js
function primesBetween(min, max) {
// inclusive
// collect all possible dividends
let dividends = [];
for (let i=min; i<=max; i++) // inclusive
dividends.push(i);
// console.log('dividends:', dividends);
View _javascript-findBinary.js
function findBinary(arr, num, ixmin=0, ixmax) {
// arr MUST be sorted!!! and only numbers!!! duh! see: https://en.wikipedia.org/wiki/Binary_search_algorithm
// ixmin and ixmax are programtic use only, meaning devuser should NEVER supply value for it
if (ixmax === undefined) ixmax = arr.length;
let ixmid = Math.floor((ixmax-ixmin)/2) + ixmin;
let elmid = arr[ixmid];
if (elmid === num) return elmid;