This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://babeljs.io/repl/#?babili=false&browsers=&build=&builtIns=false&spec=false&loose=false&code_lz=IYZwngdgxgBAZgV2gFwJYHsI2ACgLYgDmAlDAN4BQM2A7sKsjAAoBO6eqIApgHQtch0AGwBuXHMQDcVGFEyChvIekL4iUigF8KFRCgxYARmpLkZrdp178FYiT2QALLhBwSYAXgB8Z6tTkQCkoqJhrUmhraFLgA5ACMMRrGMQBMidJAA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=script&lineWrap=true&presets=es2017&prettier=false&targets=&version=7.4.5&externalPlugins= | |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "ne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First, get the unit number. | |
const getUnitNumber = fetch('https://www.lds.org/mobiledirectory/services/ludrs/1.1/mem/mobile/current-user-unitNo', { | |
credentials: 'include', | |
}) | |
.then(response => response.json()) | |
.then(response => response.message); | |
// Then download all contacts. | |
const getContacts = getUnitNumber.then(unitNumber => fetch(`https://www.lds.org/mobiledirectory/services/v2/ldstools/member-detaillist-with-callings/${unitNumber}`, { | |
credentials: 'include', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
class CountConsecutiveDuplicateLinesCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
# end and start mark the beginning and end of the current region to replace, | |
# working backwards. | |
start = end = self.view.size() | |
# Preserve trailing newline if last line is empty. | |
if self.view.line(end).empty(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://github.com/mattn/go-xmpp/blob/master/_example/example.go. | |
package main | |
import ( | |
"crypto/tls" | |
"flag" | |
"fmt" | |
"log" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each of these takes just a few milliseconds | |
app.get('/js/main.js', browserify('./public/js/main.js', { | |
external: ['three'], | |
detectGlobals: false | |
})); | |
app.get('/js/three.js', browserify(['three'], { | |
noParse: ['three'], // doesn't parse to look for global vars OR calls to require; just includes as-is | |
cache: true, // instructs browser to cache, even in dev, because this won't be changing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function example() { | |
// This cookie is good for many subsequent requests (until it expires) | |
var cookie = getCookie('[username]', '[password]'); | |
var response = ldsGet(cookie, 'https://www.lds.org/mobiledirectory/services/v2/ldstools/current-user-detail'); | |
Logger.log(response.getContentText()); | |
} | |
function getCookie(username, password) { | |
var response = UrlFetchApp.fetch('https://signin.lds.org/login.html', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias pbcopy="(printf '\033]1337;CopyToClipboard=\7'; cat -; printf '\033]1337;EndCopy\7')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CSS = require('css'); | |
function scopeCSS(css, scope) { | |
const ast = CSS.parse(css); | |
for (let rule of ast.stylesheet.rules) { | |
if (rule.type == 'rule') { | |
rule.selectors = rule.selectors.map(selector => `${scope} ${selector}`); | |
} | |
} | |
return CSS.stringify(ast); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author James Baicoianu / http://www.baicoianu.com/ | |
* Originally from http://threejs.org/examples/js/controls/FlyControls.js | |
* Simplified to only obey gamepad | |
*/ | |
THREE.FlyControls = function(object) { | |
this.object = object; | |
// API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Routes = (function() { | |
var _ = {}, ctor = function(){}; | |
_.bind = function bind(func, context) { | |
var bound, args, slice = Array.prototype.slice; | |
args = slice.call(arguments, 2); | |
return bound = function() { | |
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); | |
ctor.prototype = func.prototype; | |
var self = new ctor; | |
var result = func.apply(self, args.concat(slice.call(arguments))); |