Skip to content

Instantly share code, notes, and snippets.

@latentflip
latentflip / 1-description.md
Last active August 1, 2017 01:12
easy clone github

A simple repo clone script for a less messy ~/projects dir

I always end up with a messy projects dir. @paddyforan suggested go's structure which is something like:

$GOPATH/src/github.com/{username}/{repo} 

I've gone for:

var weevil = require('weevil');
var deval = require('deval');
console.log('Lets do something that should be blocking:');
//this code will be run in a webworker
var worker = weevil(deval(function () {
var start = +new Date();
for (var i=0; i<10000000000000; i++) {
let mapleader = ","
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" OPEN FILES IN DIRECTORY OF CURRENT FILE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>e :edit %%
map <leader>s :sp<cr>:edit %%
map <leader>v :vsp<cr>:edit %%
@latentflip
latentflip / XSS.md
Last active January 4, 2016 06:18
An explanation of solution to rafay.prakharprasad.com
var $ = window.$;
var PageView = require('./base');
var templates = require('../templates');
var HM = require('human-model');
var Model = HM.define({
props: {
name: 'string'
}
});
@latentflip
latentflip / accessiblity.md
Created November 22, 2013 11:32
300ms, Fast Click & Accessibility

Thoughts

Caveats: I suck at accessibility, so I am probably wrong on a lot of things.

The debate

Chrome 32 on Android removes the 300ms delay on touch events for responsive sites. This disables double-tap zoom, leaving pinch to zoom the only way to zoom content. This is an accessibility concern, as for some users double tap zoom may have been the only way they were able to zoom web pages.

Why did they do it?

Meeting

The room was stark. A nothing-special blue extra-hard wearing carpet, smooth white walls, topped with a depressing false ceiling made of a grid of mottled polystyrene tiles. The chair was hard and unforgiving, in front of a cold metal desk. At the other side of the desk was a plush leather task chair, currently unoccupied, and turned slightly towards the door. A single window opposed the door, looking out to a featureless grey sky.

It wasn't exactly what Anatoly had been expecting.

The door opened and a balding man in his mid 50s entered.

"Mr Volkov. A pleasure to finally meet you." The man offered his hand. "Alexis Vechi".

String.prototype.link = function(url) {
var html, text=this;
//Strings in JS have a .link() method, pretty handy, see:
html="<a href='"+url+"'>"+text+"</a>"; //before
//html=text.link(url); //after
return html;
}

Dinner

Anatoly slowly drew the knife out of it's sheath: a 10 inch Shun classic, made in Seki City, Japan. A treasured gift from Natalia on his 25th birthday. It's rippled-steel blade glinted under the warm halogen lights. He slid his thumb against the edge of the blade, checking it's edge.

The top of the onion came off first, in a single clean cut. Then it was halved, peeled, and diced in the fluid, methodical motions of experience. The diced onion joined the hot oil in the wok. Next up were a few cloves of garlic which were topped, tailed crushed against the side of the knife, peeled and diced. They joined the onions along with a few generous table spoons of red curry paste.

The concoction sizzled gently releasing a mouth, and eye, watering scent.

A handful of potatoes was pulled from the box on the counter, rinsed quartered, and slid carefully to the now boiling pot of water on the stove.

Terminus

"Go on, pick it up."

Anatoly picked up the terminus, and opened it. It's smooth, dark, carbon fiber casing sat comfortably in one hand. It had a nice weight to it, comfortable to hold, but not too light. A hundred small blue lights lit up in sequence forming a ring that glowed in the center of the opened terminus. It made no sounds, but Anatoly could feel it purring gently in the palm of his hand.

"So, what do I do?" Anatoly asked.

Gregor handed him a small lump of graphite. "Put it in the terminus."