Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
@yoshuawuyts
yoshuawuyts / npm-classic-config.sh
Last active July 5, 2017 12:36 — forked from mafintosh/npm-classic-config.sh
Resets the npm defaults to how they used to be
npm config set loglevel http
npm config set progress false
npm config set shrinkwrap false
npm config set save false
npm config set package-lock false
mkdir -p ~/.config/configstore/
printf '{"optOut": true,"lastUpdateCheck": 0}' > ~/.config/configstore/update-notifier-npm.json
var MyForm = require('my-form')
var html = require('html')
module.exports = myView
// Create an instance of MyForm
// - state is mounted as state['my-form']
// - creates an instance that's kept around
//
// Useful because:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var app = choo()
app.route('/hi', hiView)
app.route('/hello', helloView)
// static redirect
app.route('/greet', redirect('/hello'))
// conditional
app.route('/greet', function (state, emit) {
if (!state.user.sid) return hiView(state, emit)
var app = choo()
app.use(function (state, emitter) {
emitter.on('DOMContentLoaded', function () {
emitter.emit('pushState', '/foo/bar') // make sure the app has loaded before firing anything
})
})
var infiniteElements = require('cool-scroll-element')
var html = require('bel')
// Create some test data
var data = []
for (var i = 0; i < 500; i++) data.push(i)
var list = infiniteElements(function (i) {
return html`
<div id="row-${i}" style="height: 30px">
var scheduler = Scheduler()
var mainComponent = scheduler.new('main') // create a new component with a name
mainComponent.on('render', function (state, emit) {
return html``
})
mainComponent.on('load', function (done) {
/* trigger an animation that runs for 500ms */
setTimeout(500, done) // wait for animation to complete before calling "done"
})
mainComponent.on('unload', function (done) {
var merry = require('merry')
var env = merry.env({
NODE_ENV: String,
PORT: Number
})
var errors = merry.errors([
{
name: 'ENOTFOUND',
var pathname = require('pathname-match')
var http = require('http')
// this should point to your choo app, which should export if required,
// and mount itself if it's the root module. e.g.
//
// if (module.parent) module.exports = app
// else app.mount('body')
var app = require('./my-app')
#!/bin/sh
# from https://raw.githubusercontent.com/mhart/alpine-node/master/Dockerfile
VERSION='v6.10.2'
NPM_VERSION='3'
CONFIG_FLAGS="--fully-static --without-npm"
DEL_PKGS="libstdc++"
RM_DIRS=/usr/include
apk add --no-cache curl make gcc g++ python linux-headers binutils-gold gnupg libstdc++ && \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \