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
export function createSetter<T extends Record<string, any>>(setState : Dispatch<SetStateAction<T>>) { | |
return <K extends keyof T>(key : K, value : SetStateAction<T[K]>) => setState((prev : T) => ({ | |
...prev, | |
[key]: tryCall(value, prev[key]) | |
})); | |
} |
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
let r = 'αβσδεφγ῾ικλμνοπρστυξυζηω'.split('').reduce((o,curr,i) => {o['abcdefghiklmnoprstuxyzēō'[i]] = curr;return o}, {}) | |
function gr(s) { return s.replace('th','θ').replace('ch','χ').replace(/./gui, a=>r[a]||a).replace(/σ /g, 'ς ') } | |
// replace selected | |
s=window.getSelection() | |
t=s.toString() | |
p=s.focusNode.parentNode;p.innerHTML=p.innerHTML.replace(t, gr(t)) |
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
// `.mt-10` for `margin-top: 10`, etc. | |
// like in bootstrap | |
a = { m: margin, p: padding } | |
b = { '': '', t: '-top', r: '-right', b: '-bottom', l: '-left' } | |
for x, xx in a | |
for y, yy in b | |
for n in 0 5 10 15 20 | |
.{x}{y}-{n} | |
{xx}{yy}: n px |
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
<div> | |
<ul> | |
<li><a href="#">1</a></li> | |
<li><a href="#">2</a></li> | |
<li> | |
3 + | |
<ul class="drop-right"> | |
<li><a href="#">3.1</a></li> | |
<li><a href="#">3.2</a></li> | |
<li> |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>GitHub Users, A Selection</title> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
<style> | |
body { |
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
var arg = _.partial(_.includes, process.argv.slice(2)) |
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
{ | |
"scripts": { | |
"start": "node ./server/www", | |
"test": "faucet", | |
"front": "npm run bs & npm run stylus", | |
"back": "npm run nodemon & npm run stylus", | |
"build": "npm run stylus-build", | |
"deploy": "npm run build && node tasks deploy", | |
"bs": "browser-sync start --server --no-online --startPath=\"pub/index.html\" --files=\"pub/*.html, pub/css/*.css\"", | |
"stylus": "stylus -w -u nib -u jeet -u autoprefixer-stylus --sourcemap-inline pub/css/*.styl", |
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
// Media query mixins | |
mobile() | |
@media (max-width: 640px) | |
{block} | |
tablet() | |
@media (max-width: 800px) | |
{block} |
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
console.log('connecting ftp...') | |
var FTP = require('jsftp'), | |
async = require('async') | |
var ftp = new FTP({ | |
host: '', | |
port: 21, | |
user: '', | |
pass: '', |
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
function first () { | |
console.log(1) | |
} | |
function second () { | |
console.log(2) | |
} | |
function three (val) { |
NewerOlder