Skip to content

Instantly share code, notes, and snippets.

View kiasaki's full-sized avatar
🚧
Building many things

kiasaki kiasaki

🚧
Building many things
View GitHub Profile
@kiasaki
kiasaki / compile.js
Created July 24, 2016 02:16
regexes for fun, and pr... really just for fun
function compile(code) {
code = code.replace(/def\s+([a-zA-Z0-9_$]+)((?:\s[a-zA-Z0-9_$]+)+)\s+=((?:(?!\n\n)[\s\S])+)/g, function (_, functionName, args, functionBody) {
var functionArgs = args.trim().replace(/\s+/g, ', ');
return ['function ', functionName, '(', functionArgs, ') {\n return ', functionBody.trimLeft(), ';}'].join('');
});
code = code.replace(/let((?:(?!in)[\s\S])+)in/g, function(_, args) {
return 'var ' + args.trim() + ';;';
});
code = code.replace(/\n[\n]+/g, ';\n');
code = code.replace(/\n$/g, ';\n');
@kiasaki
kiasaki / write.cljs
Created July 11, 2016 06:11
eth 3 write.eth
(package eth/write (write)
(import "./types" (string string? node-name))
(import "./helpers" (escape-symbol map-pairs valid-js-ident?))
(import "./constants" (BINARY-OPERATORS UNARY-OPERATORS))
; pretty print
(defn pretty-print (node)
@kiasaki
kiasaki / app.eth.cljs
Created July 3, 2016 18:04
eth-todomvc prototype
(package todomvc ()
(import eth/core (..))
(import eth-re (app-state-update! create-component create-app-state mount))
(set KEY-ENTER "Enter")
; actions
(def add-todo (app-state title)
@kiasaki
kiasaki / grid.js
Last active June 17, 2016 03:32
An simplistic editable grid/table in React. Support click to edit, moving with arrow keys, escape, enter & looks quite good ^^,
import React, {Component, PropTypes} from 'react';
import {m} from '../../utils';
import styles from '../../styles';
let s = null;
class Grid extends Component {
constructor(props) {
super(props);
@kiasaki
kiasaki / Makefile
Created June 3, 2016 07:25
Golang project Makefile
# from https://unwiredcouch.com/2016/05/31/go-make.html?utm_source=golangweekly&utm_medium=email
# variable definitions
NAME := coolthings
DESC := a nice toolkit of helpful things
PREFIX ?= usr/local
VERSION := $(shell git describe --tags --always --dirty)
GOVERSION := $(shell go version)
BUILDTIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILDDATE := $(shell date -u +"%B %d, %Y")
/*
Nukata Lisp Light 1.4 in Go 1.6 by SUZUKI Hisao (H27.5/11, H28.2/22)
This is a Lisp interpreter written in Go.
It differs from the previous version(*1) in that all numbers are
64-bit floats and the whole interpreter consists of only one file.
It is a "light" version.
Intentionally it implements the same language as Nukata Lisp Light
1.23 in TypeScript 1.7(*2) except that it has also two concurrent
constructs, future and force. See *3.
@kiasaki
kiasaki / y.scm
Created December 16, 2015 03:26
y-comb / lamb-calc
# Mostly useless, but fun
# https://www.youtube.com/watch?v=FITJMJjASUs
(define y (f)
((lambda (x) (f (lambda (v) ((x x) v))))
(lambda (x) (f (lambda (v) ((x x) v))))))

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@kiasaki
kiasaki / aoc1-1.scm
Last active December 2, 2015 17:37
Advent of Code
(import chicken scheme)
(use utils)
(define *input* (read-all (current-input-port)))
(define (main)
(let loop ((input (string->list *input*))
(i 1))
(cond ((null? input) i)
(else (case (car input)
@kiasaki
kiasaki / app.js
Last active November 13, 2015 03:15
Node.js architecture blog post (app.js)
import express from 'express';
import container from './container';
let app = express();
// ... middlewares, config ...
// Manually setting intance
import EventEmitter from 'events';
container.set('events', new EventEmitter());