- fast feedback loop
- set up your code so you can see it working. e.g dev server, CI/CD
- code with imagination
- (you're constantly thinking of edge caes naturally and places where things can go wrong, and coding defensively, or at least with awareness)
- dogfooding, test by using
- think of it as a product, test it from the user interaction
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
// TinySegmenter 0.1 -- Super compact Japanese tokenizer in Javascript | |
// (c) 2008 Taku Kudo <taku@chasen.org> | |
// TinySegmenter is freely distributable under the terms of a new BSD licence. | |
// For details, see http://chasen.org/~taku/software/TinySegmenter/LICENCE.txt | |
function TinySegmenter() { | |
var patterns = { | |
"[一二三四五å…七八ä¹å百åƒä¸‡å„„å…†]":"M", | |
"[一-é¾ ã€…ã€†ãƒµãƒ¶]":"H", | |
"[ã-ã‚“]":"I", |
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
from hashlib import md5 | |
# See https://chromium.googlesource.com/chromium/src/+/master/components/bookmarks/browser/bookmark_codec.cc | |
def regen_checksum(roots): | |
digest = md5() | |
def digest_url(url): | |
digest.update(url['id'].encode('ascii')) | |
digest.update(url['name'].encode('UTF-16-LE')) |
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 fs = require("fs"); | |
const path = require("path"); | |
function newItem(name, url) { | |
return { name, url }; | |
} | |
const bookmarkPath = path.join( | |
process.env.HOME, | |
"/Library/Application Support/Google/Chrome/Default/Bookmarks" |
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
class Enum extends Function { | |
static opts = { enumerable: true, writeable: true, configurable: false }; | |
constructor() { | |
super(); | |
const names = (this.constructor+'').split('{')[1].split('}')[0].split(';').map(n => n.trim()).filter(n => n); | |
names.forEach((name, i) => { | |
Object.defineProperty(this.constructor, name.slice(1), { get: () => i, set: () => true, ...Enum.opts }); | |
}); | |
return this.constructor; | |
} |
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
# Configuration file for runtime kernel parameters. | |
# See sysctl.conf(5) for more information. | |
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for | |
# an explanation about some of these parameters, and instructions for | |
# a few other tweaks outside this file. | |
# | |
# See also: https://gist.github.com/kgriffs/4027835 | |
# | |
# Assumes a beefy machine with lots of network bandwidth |
This Dosyago Contributor Agreement (this "Agreement") applies to any Contribution you make to any Work. This is a binding legal agreement on you and any organization you represent. If you are signing this Agreement on behalf of your employer or other organization, you represent and warrant that you have the authority to agree to this Agreement on behalf of the organization.
- "Contribution" means any original work, including any modification of or addition to an existing work, that you submit to Dosyago in any manner for inclusion in any Work, including software source code, object code, documentation, or other material.
- "Dosyago", "we", and "us" means The Dosyago Corporation (equivalently and variously, “Dosyago”, “DOSYCORP”, “Dosy”).
- "Work" means any project, work, or materials owned or managed by Dosyago.
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 z(n) { | |
const T = 0.00001 | |
let lastT = 0; let L = Math.log(n); | |
while(Math.abs(lastT-L) > T) { lastT = L; | |
L = Math.log(n)/Math.log(L); | |
} | |
return L; | |
} | |
this is sort of the natural base of any number |
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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
usage() { | |
cat <<EOF |
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
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec |