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
#!/bin/bash | |
set -e | |
rm -f text | |
vi text | |
rm -f text.asc | |
gpg --clearsign text | |
cat text.asc | sed -e 's/^/ /' | pbcopy |
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 WIDTH = 32 | |
const fs = require('fs') | |
const chalk = require('chalk') | |
const hsl2rgb = require('pure-color/convert/hsl2rgb') | |
// const e = require('emoji.json') | |
const file = fs.readFileSync(process.argv[2]) | |
file.forEach((char, index) => { | |
const rgb = hsl2rgb([char / 256 * 360, 100, 50]).map(i => Math.floor(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
someArray.sort(({ [key]: a }, { [key]: b }) => ((ascending ? a < b : a > b) ? 1 : -1)) |
Assuming you have two git repositories monorepo
, and my-project
and want to add my-project
to monorepo/projects/my-project
:
cd my-project
git filter-branch --index-filter '
git ls-files -s |
sed "s, ,&'"projects/my-project/"'," |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
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 | |
PREFIX="versions/my-app/" | |
SUFFIX="" | |
git tag -l | while read t; do | |
NEW_NAME="${PREFIX}${t}${SUFFIX}" | |
git tag $NEW_NAME $t | |
git tag -d $t | |
done |
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 appointments = [[100, 125], [200, 230], [230, 400]] | |
const requests = [[10, 50], [130, 210], [240, 250]] | |
const times = [[0]] | |
for (let i = 0; i < appointments.length; i++) { | |
const [ra, rb] = appointments[i] | |
const last = times[times.length - 1] | |
last[1] = ra |
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 node | |
const WebSocketClient = require('websocket').client | |
const attempt = () => | |
new Promise((resolve, reject) => { | |
const client = new WebSocketClient() | |
client.on('connectFailed', error => { | |
console.log('Connect Error: ' + error.toString()) | |
resolve() |
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 mapBranchesGetter = <G extends keyof BranchesStore>( | |
getter: G | |
): BranchesStore[G] => { | |
return this.context.rootGetters[`branches/${getter}`] | |
} | |
const getBranch = mapBranchesGetter('getBranch') | |
const mapGetter = <S, G extends keyof S>(namespace: string, getter: string): S[G] => { | |
return this.context.rootGetters[`${namespace}/${getter}`] | |
} |
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
<html> | |
<head> | |
<!-- Any idea whatsoever why input.works works and input.wtf is completely | |
unstyled in firefox & chrome? Also, input.half-wtf works in Firefox, even | |
when swapping around the lines. --> | |
<style> | |
input { | |
-moz-appearance: none; | |
-webkit-appearance: none; | |
appearance: none; |