Skip to content

Instantly share code, notes, and snippets.

View foxbunny's full-sized avatar

Hajime Yamasaki Vukelic foxbunny

View GitHub Profile
@foxbunny
foxbunny / chip-flash.sh
Created May 16, 2016 13:53
Script to flash CHIP
#!/bin/bash
#
# This script programs the CHIP's NAND flash using sunxi-tools' `fel` utiltiy,
# and U-Boot itself. The following tools must be present on the system:
#
# - dd (coreutils)
# - lsusb (usbutils)
# - fel (sunxi-tools)
# - mkimage (android-tools)
#
var path = require('path')
module.exports = {
entry: './src/index.js',
output: {
path: './static',
publicPath: '/static/',
filename: 'app.js',
},
module: {
module.exports = {
entry: './src/index.js',
output: {
path: './pub/static',
publicPath: '/static/',
filename: 'bundle.js',
}
}
// updateSearchPct :: s -> s -> s
export const updateSearchPct = match(ADD_FLIGHTS,
state => R.assoc('searchPct',
Math.round(state.tickets.length / state.searchTotal) * 100, state))
@foxbunny
foxbunny / max.erl
Last active February 22, 2017 19:15
-module(max).
-export([maxThree/3, howManyEqual/3, xOr1/2, xOr2/2, xOr3/2, tests/0]).
maxThree(X, Y, Z) -> max(X, max(Y, Z)).
xOr1(X, Y) -> not (X == Y).
xOr2(X, Y) -> X =/= Y.
xOr3(X, Y) -> X == not(Y).
@foxbunny
foxbunny / fib.erl
Last active February 23, 2017 17:43
-module(fib).
-export([fib/1, tests/0]).
fibOf(0) ->
0;
fibOf(1) ->
1;
fibOf(N) ->
fibOf(N-1) + fibOf(N-2).
@foxbunny
foxbunny / jsx.d.ts
Last active September 14, 2017 13:00
JSX definition for Vue.js
// I'm not the original author of this code. Please let me
// know if you know/find the original author so I can fully
// attribute.
import Vue, { VNode } from "vue";
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends Vue {}
@foxbunny
foxbunny / webpack.config.ts
Last active August 19, 2017 09:00
Bare-bones webpack 2 configuration for typescript projects
/**
* (c) 2017 Hajime Yamasaki Vukelic
* Some rights reserved.
*
* yarn add -D webpack webpack-dev-server ts-node ts-loader html-webpack-plugin @types/webpack @types/html-webpack-plugin
*/
import path = require("path");
import HTMLWebpackPlugin = require("html-webpack-plugin");
@foxbunny
foxbunny / jsx-dom.js
Last active November 21, 2019 23:04
JSX helper for creating DOM nodes
const h = (tag, attrs, ...children) => {
const elm = document.createElement(tag)
for (let key in attrs) {
if (key.slice(0, 2) == 'on') {
const evtName = key.slice(2)
const cb = attrs[key]
if (cb == null) continue // we can use null or undefnied to suppress
elm.addEventListener(evtName, cb)
} else if (['disabled', 'autocomplete', 'selected', 'checked'].indexOf(key) > -1) {
if (attrs[key]) {
@foxbunny
foxbunny / .block
Created March 31, 2018 11:58
Basic bar chart
license: mit