Skip to content

Instantly share code, notes, and snippets.

Hajime Yamasaki Vukelic foxbunny

Block or report user

Report or block foxbunny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@foxbunny
foxbunny / .vimrc
Created May 23, 2019
Local Vim configuration for C projects
View .vimrc
# Taken from http://www.alexeyshmalko.com/2014/using-vim-as-c-cpp-ide/
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
augroup project
autocmd!
autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen
@foxbunny
foxbunny / email.regex.js
Created Mar 8, 2019
Reasonably good regexp library
View email.regex.js
const emailRe = /^([\w\d\-+](\.?[\w\d_\-+])*)@(((2([0-4]\d|5[0-5])|1?\d{1,2})\.){3}(2([0-4]\d|5[0-5])|1?\d{1,2})|[a-z\d]([a-z\d-]{1,61}[a-z\d])?(?:\.[a-z]{2,})+)$/
// Able to pass the test samples here: https://blogs.msdn.microsoft.com/testing123/2009/02/06/email-address-test-cases/
View functools.js
function reduce(transform, append, arr, init) {
const l = arr.length
let i = 0
let accum = init
if (typeof accum === 'undefined') {
accum = arr[0]
i = 1
}
for (; i < l; i++) {
accum = append(accum, transform(arr[i]))
@foxbunny
foxbunny / ImbaAdapter.js
Last active Nov 21, 2018
Imba-Vue adapter for using Imba apps inside Vue
View ImbaAdapter.js
import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator'
import Imba from 'imba'
/**
import { App } from './App.imba'
import ImbaAdapter from './ImbaAdapter'
@foxbunny
foxbunny / .block
Created Mar 31, 2018
Basic bar chart
View .block
license: mit
@foxbunny
foxbunny / jsx-dom.js
Last active Mar 17, 2018
JSX helper for creating DOM nodes
View jsx-dom.js
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 / webpack.config.ts
Last active Aug 19, 2017
Bare-bones webpack 2 configuration for typescript projects
View webpack.config.ts
/**
* (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.d.ts
Last active Sep 14, 2017
JSX definition for Vue.js
View jsx.d.ts
// 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 {}
View fib.erl
-module(fib).
-export([fib/1, tests/0]).
fibOf(0) ->
0;
fibOf(1) ->
1;
fibOf(N) ->
fibOf(N-1) + fibOf(N-2).
View max.erl
-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).
You can’t perform that action at this time.