const type = a => (
a === null ? 'null'
: a === undefined ? 'undefined'
: Object.prototype.toString.call(a).slice(8, -1))
This file contains hidden or 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
/* eslint-disable no-console,import/no-dynamic-require,global-require */ | |
const path = require('path') | |
const gulp = require('gulp') | |
const R = require('ramda') | |
const watch = require('gulp-watch') | |
const webpack = require('webpack') | |
const { terminal } = require('terminal-kit') | |
const { ProgressPlugin } = webpack | |
const webpackPath = './webpack.config.js' |
This file contains hidden or 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
multiple () { | |
local l x y p c | |
c=0 p=0 l=() | |
while :; do | |
case $1 in | |
-p) | |
if [[ $2 = -* ]]; then | |
echo '-p requires an argument' | |
return | |
fi |
This file contains hidden or 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 tput = require('./tput')() | |
tput.write('smcup') | |
tput.write('cup 0 0') | |
process.stdout.write('foo') | |
process.on('exit', () => { | |
tput.write('rmcup') | |
process.exit() | |
}) |
This file contains hidden or 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 crypto = require('crypto') | |
module.exports = function hash({ method }, input) { | |
return new Promise((res, rej) => { | |
const h = crypto.createHash(method) | |
h.on('readable', () => { | |
const data = h.read() | |
if (data) { | |
res(data.toString('hex')) | |
} else rej() |
This file contains hidden or 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
import { useState, useEffect } from 'react' | |
export default function useJson(props) { | |
const [state, _setState] = useState({ | |
data: props.initData, | |
error: null, | |
loading: true, | |
}) | |
const setState = patch => s => _setState({ ...s, ...patch }) |
This file contains hidden or 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 | |
declare loud=0 | |
declare urgent | |
declare old_volume | |
declare old_volume | |
cleanup() { | |
set_volume "$old_volume" |
FROM postgres:14
RUN apt-get update && apt-get upgrade -y
ENV build_deps ca-certificates \
git \
build-essential \
libpq-dev \
postgresql-server-dev-14
RUN apt-get install -y --no-install-recommends $build_deps
This file contains hidden or 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
-- Set <space> as the leader key | |
-- See `:help mapleader` | |
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) | |
vim.g.mapleader = " " | |
vim.g.maplocalleader = " " | |
vim.g.loaded_netrwPlugin = 1 | |
vim.opt.autoread = true | |
vim.opt.backspace = "indent,eol,start" -- backspace over everything | |
vim.opt.colorcolumn = { 80 } -- highlight 80th column |
This file contains hidden or 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
-- {{{ libraries | |
local gears = require('gears') | |
local awful = require('awful') | |
awful.autofocus = require('awful.autofocus') | |
-- Widget and layout library | |
local wibox = require('wibox') | |
-- Theme handling library | |
local beautiful = require('beautiful') | |
-- Notification library | |
local naughty = require('naughty') |