Skip to content

Instantly share code, notes, and snippets.

//
// Settings
//
const MAX_TASKS_SHOWN = 5;
const NOW = new Date();
const BG_COLOR = Color.black();
const TITLE_COLOR = Color.white();
const TITLE_FONT = Font.systemFont(20);
const OVERDUE_COLOR = new Color("#f73c82");
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: teal; icon-glyph: magic;
//
// Settings
//
const LOOK_BEHIND_HOURS = 1;
const LOOK_AHEAD_HOURS = 2;
const MAX_EVENTS_IN_WIDGET = 5;
@jsloat
jsloat / Bear.Backlinks.js
Last active December 27, 2022 23:27
Generate backlinks for Bear notes in Scriptable on iOS
@jsloat
jsloat / refactor.js
Last active November 15, 2018 14:49
Usage is a bit rough -- currently I copy and paste the code into a node terminal, then call refactor with a multi-line string as argument (using backticks)
refactor = oldCode => {
const defineBlock = /define\((?:['"].*?['"],\s*)?\[(.*?)\],\s*?(?:function|)\s*?\((.*?)\)/gms;
const match = defineBlock.exec(oldCode);
if (!match) {
return 'No matches found, error';
}
const groupBrackets = (acc, item) => {
const hasBracket = {
left: Boolean(/\{/.exec(item)),
right: Boolean(/\}/.exec(item))
// To play Minesweeper, we will create instances of MineSweeperGame in command line.
// For example:
// In the command line, navigate to the lib directory and run `node`
// Run `.load game.js` to load the contents of this file.
// Then create a Game instance and run commands like so:
// let game = new Game(3, 3, 3);
// game.playMove(0, 1);
// game.playMove(1, 2);
// When done run `.exit`
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Game = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
// To play Minesweeper, we will create instances of MineSweeperGame in command line.
// For example:
<body><div class="header-container">
<!--=== Header ===-->
<header class="header">
<nav class="navbar navbar-fixed-top navbar-default navbar-main" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-main">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<body><div class="header-container">
<!--=== Header ===-->
<header class="header">
<nav class="navbar navbar-fixed-top navbar-default navbar-main" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-main">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>