Skip to content

Instantly share code, notes, and snippets.

Rabbie Swift Medley
Ah bide it tay late
got naethin' in mah brain
I’m a staumrel fowk say
that's whit fowk say, mmm
i gang oan tay mony dates
but Ah cannae make them bide
at leest that's whit fowk say, mmm-mmm
@latentflip
latentflip / index.js
Last active August 29, 2015 14:13
requirebin sketch
var Collection = require('ampersand-collection');
var SubCollection = require('ampersand-subcollection');
var Model = require('ampersand-model');
var MyModel = Model.extend({
props: {
name: 'string',
selected: 'boolean'
}
});
@latentflip
latentflip / index.js
Created December 18, 2014 09:24
requirebin sketch
var AmpersandModel = require('ampersand-model');
var AmpersandCollection = require('ampersand-rest-collection');
var Model = AmpersandModel.extend({
props: {
title: 'string'
}
});
var MyCollection = AmpersandCollection.extend({
@latentflip
latentflip / gf.md
Last active April 14, 2021 03:29
vim, gf, and node

Vim, gf and node.

So, I just learned that gf exists. If your cursor is over a path in vim, and you type gf, it'll open that file/dir in a new buffer. You can also open in a new window/tab as detailed here.

In node, it'd be great if you could jump to a required file, huh? Trouble is, typically you don't put the .js on your require('./path/to/a/js/file'). No matter, vim has your back, just add set suffixesadd+=.js to your .vimrc and vim will try adding .js and see if it can find that file instead.

If you do a lot of spelunking in node_modules, it'd be great if you could jump to the directory of a required npm module too, right? A la, require('my-awesome-module'). Well, you can add set path+=$PWD/node_modules to your .vimrc too, and vim will add node_modules to the path, and jump to it's directory in node_modules (caveat: you must have opened vim from your project root for this too work).

For your cmd+c convenience:

@latentflip
latentflip / index.js
Created December 9, 2014 20:06
requirebin sketch
var src = "<div class=\"landing\"><div class=\"container\"><section id=\"pages\"><section role=\"main\" class=\"page create\"><div class=\"room cf\"><a href=\"/\" title=\"Welcome to Talky!\" class=\"talky-logo\"></a><form id=\"createRoom\" class=\"cf\"><p>Truly simple video chat and screen sharing for small groups.</p><input id=\"sessionInput\" placeholder=\"Name the conversation\" autofocus=\"autofocus\" type=\"text\"><button type=\"submit\" class=\"primary large\">Let’s go!</button></form></div><div class=\"features cf\"><h2>Anonymous. Peer‑to‑peer. No plugins, signup, or payment required.</h2><div class=\"feature\"><h3>Group video chat</h3><p>Add up to 5 people to the conversation </p></div><div class=\"feature\"><h3>Screen sharing</h3><p>Easily add anyone's screen to the conversation</p></div><div class=\"feature\"><h3>Locked rooms</h3><p>Add a shared key to a room for added privacy</p></div><div class=\"feature\"><h3>Mobile, too!</h3><p> \nTalky iOS is available</p><a href=\"https://itunes.apple.com/app/
@latentflip
latentflip / index.js
Created December 1, 2014 16:34
requirebin sketch
var View = require('ampersand-view').extend({
template: '<div><input type="checkbox" ><a>click me</a></div>',
props: {
theState: 'boolean'
},
events: {
'click [type=checkbox]': 'toggleState',
'click a': 'toggleState'
},
bindings: {
@latentflip
latentflip / index.js
Created October 30, 2014 09:54
requirebin sketch
var State = require('ampersand-state').extend({
props: {
id: 'number',
age: 'number'
}
});
var s = new State({ id: 1, age: 10 })
@latentflip
latentflip / index.js
Created September 26, 2014 08:43
requirebin sketch
var View = require('ampersand-view');
var MyView = View.extend({
template: '<h1>Hello</h1>'
});
var view = new MyView();
view.render();
document.body.appendChild(view.el);
//
// Lame implementation of a channel
function channel() {
return new Channel();
}
var id = 0;
function Channel(opts) {
this._queue = [];
@latentflip
latentflip / index.js
Created September 8, 2014 17:37
requirebin sketch
var AmpersandView = require('ampersand-view');
module.exports = AmpersandView.extend({
initialize: function () {
var self = this;
app.people.getOrFetch(options.personId, function (err, person) {
if (err) { throw err; }
self.model = person;
});