View generate-index-from-config.js
// For every website folder that contains a certain file, autogen an index.html landing page for it. | |
const { readdirSync, statSync, writeFileSync, existsSync, readFileSync } = require('fs'); | |
const { join } = require('path'); | |
// ----------------------------------------- Config | |
const DIR = '/home/deploy/www'; | |
const CONFIG_FILE = 'logo/info.txt'; |
View generate-nginx-config.js
const { readdirSync, statSync, writeFileSync } = require('fs') | |
const { join } = require('path') | |
// ----------------------------------------- Config | |
const DIR = '/home/deploy/www'; | |
const TARGET = '/home/deploy/deployNginxConfig'; | |
const HEADER = ` | |
# Config generated by 'generate-nginx-config.js', do not hand-edit |
View addFileToGit.js
const Octokit = require('@octokit/rest'); // https://octokit.github.io/rest.js/ | |
// Customize this stuff: | |
const auth = 'your-key-generated-in-github-ui'; // PRIVATE! | |
const owner = 'repo-owner'; | |
const repo = 'your-repo-name'; | |
// Constants | |
const userAgent = 'git commiter v1'; | |
const ref = 'heads/master'; |
View node-get-file-contents.js
const fs = require('fs') | |
const path = require('path') | |
const DIR = 'input/'; | |
const readFile = name => fs.readFileSync(name); | |
(async () => { | |
const files = fs.readdirSync(DIR) | |
.filter(s => s.match(/\.csv$/)) // only .csv files -- change to whatever you want. |
View sort-object-keys.ts
export interface SomeShape { | |
b: string, | |
c: string, | |
a: string, | |
} | |
// Specify your sort order here | |
const rank: Array<keyof SomeShape> = ['a', 'b', 'c']; | |
export function sortedKvpString(obj: SomeShape) { |
View keybindings.json
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "cmd+d", | |
"command": "editor.action.copyLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", | |
"command": "-editor.action.copyLinesDownAction", |
View count-dom-words.js
// Procedure: | |
countWords(document.body); | |
/* | |
* Count the text inside each element. | |
* Parents include all the words of their children. |
View ExternalUrl.ts
@Injectable({providedIn: 'root'}) | |
export class ExternalUrlService implements CanActivate { | |
canActivate({ data }: ActivatedRouteSnapshot): boolean { | |
window.open(data.externalUrl, '_blank'); | |
return false; | |
} | |
} |
View keymap.cson
'atom-text-editor': | |
'cmd-backspace': 'editor:delete-line' | |
'cmd-up': 'editor:move-line-up' | |
'cmd-down': 'editor:move-line-down' | |
'cmd-d': 'editor:duplicate-lines' |
View shades-and-lights.scss
// Lights (white as a transparency) | |
$light10: rgba(255, 255, 255, 0.10); | |
$light20: rgba(255, 255, 255, 0.20); | |
$light30: rgba(255, 255, 255, 0.30); | |
$light40: rgba(255, 255, 255, 0.40); | |
$light50: rgba(255, 255, 255, 0.50); | |
$light60: rgba(255, 255, 255, 0.60); | |
$light70: rgba(255, 255, 255, 0.70); | |
$light80: rgba(255, 255, 255, 0.80); |
NewerOlder