Skip to content

Instantly share code, notes, and snippets.

@btakita
btakita / resolve__rollup.js
Last active March 23, 2018 22:02
Resolve from current directory
/** Add this into the rollup plugins array
resolve__rollup({
paths: ['.', 'node_modules'],
extensions: ['.mjs', '.js', '.json', '.tag']
})
*/
function resolve__rollup(options) {
return {
name: 'resolve__rollup',
<div class="jumbotron">
<div class="row">
<div class="col-md-6">
<h1>Svelte (keyed)</h1>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="run" on:click="run()">Create 1,000 rows</button>
</div>
@btakita
btakita / webpack-buble-plugin.js
Last active March 7, 2018 23:38
BublePlugin for Webpack
class BublePlugin {
apply(compiler) {
compiler.plugin('emit', (compilation, callback) => {
compilation.chunks.forEach(chunk => {
chunk.files.forEach(function(filename) {
if (/\.js$/.test(filename)) {
const source = compilation.assets[filename].source()
, __buble = buble.transform(source)
compilation.assets[filename] = {
source() {
agent__xyz(ctx).on('change', (ctx) => {
const {x,y,z} = ctx
})
agent__a(ctx).set({a:1})
function agent__xyz(ctx) {
let agent = ctx.agent__xyz
if (agent) return agent
return ensure__agent(ctx, {
key: 'agent__xyz',
scope: ['x', 'y', 'z'],
@btakita
btakita / Index.html
Last active August 27, 2017 10:21
Svelte Isomorphic Components with Hydration (http://www.briantakita.com/posts/sveltejs-from-pug/)
<!-- Index.html is used in DOM & SSR -->
<Layout id="index" class__root="Index" ctx="{{ctx}}">
<main>
<article ref:presentation id="presentation">
<section class="slide-0">
Slide 0
</section>
<section class="slide-1">
Slide 1
</section>
<div class="Dossier__Search">
<input type="text" bind:value="query__search"/>
<ul class="search__people" class="{{class__search__people}}">
{{#each search__people as person}}
<li on:click="click__search__person(event, person)">
{{person.name}}
</li>
{{/each}}
</ul>
@btakita
btakita / us-locations.json
Last active June 7, 2016 00:01
Used by suppressthis.org - DO NOT REMOVE
[{"zipcode":"10001","state_abbr":"NY","latitude":"40.750742","longitude":"-73.99653","city":"New York","state":"New York"},{"zipcode":"10002","state_abbr":"NY","latitude":"40.717040","longitude":"-73.98700","city":"New York","state":"New York"},{"zipcode":"10003","state_abbr":"NY","latitude":"40.732509","longitude":"-73.98935","city":"New York","state":"New York"},{"zipcode":"10004","state_abbr":"NJ","latitude":"40.699226","longitude":"-74.04118","city":"New York","state":"New Jersey"},{"zipcode":"10005","state_abbr":"NY","latitude":"40.706019","longitude":"-74.00858","city":"New York","state":"New York"},{"zipcode":"10006","state_abbr":"NY","latitude":"40.707904","longitude":"-74.01342","city":"New York","state":"New York"},{"zipcode":"10007","state_abbr":"NY","latitude":"40.714754","longitude":"-74.00721","city":"New York","state":"New York"},{"zipcode":"10009","state_abbr":"NY","latitude":"40.727093","longitude":"-73.97864","city":"New York","state":"New York"},{"zipcode":"10010","state_abbr":"NY","latitud
@btakita
btakita / prototypeSmash.js
Created February 8, 2016 13:28
prototypeSmash - assign Object.getPrototypeOf(obj), obj
export default function prototypeSmash(obj) {
return Object.assign.apply(Object, [{}].concat(Object.getPrototypeOf(obj), obj));
}
@btakita
btakita / bundle.build.js
Last active January 11, 2016 03:19
browserify,babelify,riotify,uglify,gzip-size build script
#!/usr/bin/env babel-node
var fs = require('fs')
, path = require('path')
, browserify = require('browserify')
, babelify = require('babelify')
, riotify = require('riotify')
, uglify = require('uglify-js2')
, watchify = require('watchify')
, gzipSize = require('gzip-size')
, source = require('vinyl-source-stream')
echo
null
id
25818655
import_id
25818655