Skip to content

Instantly share code, notes, and snippets.

View jinjor's full-sized avatar

Yosuke Torii jinjor

View GitHub Profile
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@eguven
eguven / brew-list.sh
Last active November 16, 2024 19:55
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
const fs = require("fs");
const childProcess = require("child_process");
childProcess.exec("./node_modules/.bin/elm-analyse", (e, out) => {
let file;
let all = {};
for (let line of out.split("\n")) {
if (line.startsWith("-")) {
file = line.slice(2);
continue;
type MIDIInputMap = Map<DOMString, MIDIInput>; // maplike
type MIDIOutputMap = Map<DOMString, MIDIOutput>; // maplike
type DOMString = string;
interface MIDIAccess extends EventTarget {
readonly inputs: MIDIInputMap;
readonly outputs: MIDIOutputMap;
onstatechange: (e: MIDIConnectionEvent) => void;
readonly sysexEnabled: boolean;
}
module.exports.mergeCoverageByUrl = function(coverage) {
const merged = {};
for (const entry of coverage) {
if (!merged[entry.url]) {
merged[entry.url] = entry;
}
merged[entry.url].ranges.push(...entry.ranges);
}
Object.values(merged).forEach(entry => {
entry.range = convertToDisjointRanges(entry.ranges);
@jinjor
jinjor / rpc-client.js
Last active December 31, 2019 09:53
RPC between Browser and Node.js
async function exec(name, ...args) {
const res = await fetch(`/rpc/${name}`, {
method: "POST",
headers: {
"content-type": "application/json"
},
body: JSON.stringify(args)
});
const json = await res.json();
return json;