Skip to content

Instantly share code, notes, and snippets.

View whomwah's full-sized avatar

Duncan Robertson whomwah

View GitHub Profile
@whomwah
whomwah / settings.json
Created November 3, 2022 10:02
Deno VSCode Settings
{
"deno.enable": true,
"deno.lint": true,
"deno.suggest.imports.hosts": {
"https://deno.land": false
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "denoland.vscode-deno"
},
@whomwah
whomwah / readme.md
Created June 23, 2021 09:07
Utils #utils

example of chopping massive.csv into smaller mini.csv files of 1000 lines

$ brew install coreutils
$ gsplit -dl 10000 --additional-suffix=.csv massive.csv mini
$
$ ls -A1
mini00.csv
mini01.csv
mini02.csv
@whomwah
whomwah / mopidy.d.ts
Last active November 2, 2022 13:24
Type definitions for Mopidy.js
// Type definitions for Mopidy.js v1.1.0, Mopidy v3.0.2 WebSocket API
// Project: https://github.com/mopidy/mopidy.js
// Definitions by: Alan Norbauer <https://alan.norbauer.com>
// Duncan Robertson <https://github.com/whomwah>
export = Mopidy
declare class Mopidy {
// ----------------- MOPIDY.JS-SPECIFIC API -----------------
@whomwah
whomwah / server.tsx
Last active November 11, 2022 23:47
Deno / React example
// @deno-types="https://deno.land/x/types/react/v16.13.1/react.d.ts"
import React from "https://dev.jspm.io/react@16.13.1";
// @deno-types="https://deno.land/x/types/react-dom/v16.13.1/server.d.ts"
import ReactDOMServer from "https://dev.jspm.io/react-dom@16.13.1/server";
import { opine } from "https://deno.land/x/opine@0.3.0/mod.ts"
export {
Request,
Response,
NextFunction,
} from "https://deno.land/x/opine@0.3.0/src/types.ts";
@whomwah
whomwah / README.md
Last active February 7, 2020 16:14
[JS Testing] #js

Helpful JS testing tips

JEST Mocking

Spotify.validateTrack.mockImplementation(trackMock)
Decorator.parse.mockResolvedValue('unifiedMessage')
User.findOneAndUpdate.mockRejectedValue(new Error('bang'))
@whomwah
whomwah / README.md
Created January 29, 2020 09:57
[TMUX] #tmux

Start new session with name

tmux new -s mysession

Attach to existing session

tmux a -t mysession

Attach to last session

tmux a

List sessions

@whomwah
whomwah / README.md
Created October 7, 2019 08:23
[Semantic Commit Messages] #git
@whomwah
whomwah / README.md
Created April 11, 2019 08:26
[Swift] #swift

To observer any notification

center.addObserver(forName: nil, object: nil, queue: nil) { (note) in
  print("note: \(note)")
}