Skip to content

Instantly share code, notes, and snippets.

@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'],
<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 / 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>
@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')
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
echo
null
id
25818655
import_id
25818655
@btakita
btakita / jasmine-node-overrides.js
Last active September 7, 2019 11:11
Fix for it & Fast failure output for jasmine-node.
function fixIt() {
GLOBAL.it = function() {
return jasmine.getEnv().it.apply(jasmine.getEnv(), arguments);
}
}
function immediateErrorOutput() {
var theOriginalFail = jasmine.Spec.prototype.fail;
jasmine.Spec.prototype.fail = function (e) {
theOriginalFail.apply(this, arguments);