Skip to content

Instantly share code, notes, and snippets.

View greek-transliterate.js
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))
@eyy
eyy / util.styl
Created May 8, 2021
stylus utilities classes
View util.styl
// `.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
@eyy
eyy / drop-right.html
Created May 28, 2019
Drop-right: a simple dropdown to the right
View drop-right.html
<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>
View vue-gh-random-users.html
<!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 {
View quick_args.js
var arg = _.partial(_.includes, process.argv.slice(2))
@eyy
eyy / package.json
Last active Aug 29, 2015
My `package.json` scripts
View package.json
{
"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",
@eyy
eyy / media-query-mixins.styl
Created Aug 4, 2015
Media query mixins for Stylus
View media-query-mixins.styl
// Media query mixins
mobile()
@media (max-width: 640px)
{block}
tablet()
@media (max-width: 800px)
{block}
@eyy
eyy / ftp-deploy.js
Created Aug 4, 2015
Deploy static site to FTP
View ftp-deploy.js
console.log('connecting ftp...')
var FTP = require('jsftp'),
async = require('async')
var ftp = new FTP({
host: '',
port: 21,
user: '',
pass: '',
@eyy
eyy / tasks.js
Last active Aug 29, 2015
Takser – node task runner
View tasks.js
function first () {
console.log(1)
}
function second () {
console.log(2)
}
function three (val) {
@eyy
eyy / rout-example.html
Last active Aug 29, 2015
Rout.js – DOM Router
View rout-example.html
<style>
route {
display: block;
background: yellow;
}
route[path] {
display: none;
}
</style>