GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)
- not equal
~=
- logical AND
&&
/** | |
* A Node.js utility that can be used to determine what function | |
* and file your function was called from. Useful for debugging | |
* large/complex codebases. | |
* | |
* @returns {{ | |
* fnName: string | void; | |
* filePath: string; | |
* lineNumber: number; | |
* columnNumber: number; |
// ==UserScript== | |
// @name jupyter notebook page follow | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description Add 'page follow' feature to jupyter notebook pages | |
// @author Chris Deacy | |
// @match http*://*/notebook*/* | |
// @downloadURl https://gist.github.com/chrisdothtml/51c2b5ca2dc9c498fe27d0d464b47801/raw/JupyterPageFollower.user.js | |
// @updateURl https://gist.github.com/chrisdothtml/51c2b5ca2dc9c498fe27d0d464b47801/raw/JupyterPageFollower.user.js | |
// @grant none |
#!/bin/bash | |
### | |
# Usage example: | |
# | |
# . "path/to/discoverable_bash.sh" | |
# | |
# import { indent_lines } from './_utils.sh' | |
# call '../bins/start.sh' "foo" | |
### |
GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)
~=
&&
/* | |
* Get fixed issue references from GitHub pull request body | |
*/ | |
function getIssueRefs(pullRequestBody, defaultRepoName) { | |
// ref: https://help.github.com/en/articles/closing-issues-using-keywords | |
const keywords = 'close|closed|closes|fix|fixed|fixes|resolve|resolved|resolves'; | |
// ref: https://help.github.com/en/articles/autolinked-references-and-urls#issues-and-pull-requests | |
const refTypes = [ | |
// #000 | |
'#', |
function getPipedInput () { | |
return new Promise(resolve => { | |
let result = '' | |
process.stdin.resume() | |
process.stdin.setEncoding('utf8') | |
process.stdin.on('data', chunk => (result += chunk)) | |
process.stdin.on('end', () => resolve(result)) | |
}) | |
} |
/* | |
* Calculate the persistence of a number; | |
* based on Numberphile video: | |
* https://www.youtube.com/watch?v=Wim9WJeDTHQ | |
*/ | |
function calculatePersistence (num) { | |
let result = 1 | |
while ((num = multiplyItems(getDigits(num))) > 0) | |
result++ | |
return result |
/** | |
* Indicates whether the sum of the factors of a number | |
* are equal to the number | |
* https://en.wikipedia.org/wiki/Perfect_number | |
* | |
* @param {Number} num | |
* @returns {Boolean} | |
*/ | |
function isPerfectNumber (num) { | |
const numRoot = Math.sqrt(num) |
/** | |
* Get all factors of a number | |
* | |
* @param {Number} num | |
* @returns {Set} | |
*/ | |
function getFactors (num) { | |
const numRoot = Math.sqrt(num) | |
const isEven = num % 2 === 0 | |
const incr = isEven ? 1 : 2 |