Skip to content

Instantly share code, notes, and snippets.

View makenowjust's full-sized avatar
㊗️
The IDOLM@STER MILLION LIVE THE ANIMATION

Hiroya Fujinami makenowjust

㊗️
The IDOLM@STER MILLION LIVE THE ANIMATION
View GitHub Profile
// if you remove this bang symbol, this code dosen't work.
!{
en: () => { alert('you can use English?') },
js: () => { alert('you can use Japanese!') }
// and more languages...
}[navigator.language]()
// this example works fine, but ...
({foo, bar} = {foo: 1, bar: 2})
'let', {foo, bar} = {foo: 1, bar: 2}
@makenowjust
makenowjust / lisp.js
Created October 28, 2015 03:12
I dont have yaruki...
p=s=>s.replace(/[()]|[^() ]+/g,' $& ').split(/\s+/g).filter(c=>c).reduce((s, c)=>(({'(':_=>s.s.push([s.c,s.c.push(s.c=[])][0]),')':_=>s.c=s.s.pop()}[c]||(_=>s.c.push(/^\d+$/.test(c)?+c:c)))(),s),{s:[],c:[]}).c;t=l=>l[l.length-1];b=x=>Array.isArray(x)?x.length:x;x=l=>Array.isArray(l)?({set:_=>e[l[1]]=t(l.slice(2).map(x)),fn:_=>(a,f,r)=>(f=e,e=Object.create(_),l[1].map((v,i)=>e[v]=a[i]),r=l.slice(2).map(x),e=f,t(r)),if:_=>x(b(x(l[1]))?l[2]:l[3]),quote:_=>l.slice(1)}[l[0]]||(_=>(l=l.map(x),l[0](l.slice(1)))))(e):l in e ?e[l]:l;e='+ - * / < > <= >= == !='.split(' ').reduce((e,o)=>(e[o]=eval(`a=>a[0]${o}a[1]`),e),{exit:_=>process.exit(),println:a=>console.log.apply(console,a),print:a=>process.stdout.write(a[0]+''),eval:x,car:a=>a[0][0],cdr:a=>a[0].slice(1),cons:a=>[a[0],a[1]]});i=require('readline').createInterface({input:process.stdin,output:process.stdout}).on('line',l=>{console.log(t(p(l).map(x)));i.prompt()});i.prompt()
@makenowjust
makenowjust / bsearch.cr
Last active November 4, 2015 11:36
Experimental Range/Array#bsearch implementation
private def bsearch_internal(from : Float, to, exclude)
bsearch_internal(from, to.to_f64, exclude){ |x| yield x }
end
private def bsearch_internal(from, to : Float, exclude)
bsearch_internal(from.to_f64, to, exclude){ |x| yield x }
end
private def bsearch_internal(from : Float, to : Float, exclude)
i2f = ->(i : Int64) {
@makenowjust
makenowjust / .travis.yml
Created November 28, 2015 07:19
.travis.yml of the Crystal
language: generic
sudo: required
services:
- docker
matrix:
include:
- env: ARCH=i386 ARCH_CMD=linux32
os: linux
- env: ARCH=x86_64 ARCH_CMD=linux64
os: linux
@makenowjust
makenowjust / post-checkout
Created November 30, 2015 11:23
hook script for commlog
#!/bin/bash
if [[ "$(git symbolic-ref --short HEAD)" = "commlog" ]]; then
cd "$(git rev-parse --show-cdup)"
echo "*" > .gitignore
fi
@makenowjust
makenowjust / crystalw
Created December 14, 2015 11:02
Crystal wrapper script
#!/usr/bin/env bash
find_crystal_project_root() {
pushd . 2>&1 >/dev/null
while [[ "$PWD" != "/" ]]; do
if [[ -f "shard.yml" ]]; then
echo -e "\e[33mDetect crystal project in $(pwd)\e[0m"
export CRYSTAL_PATH="$(pwd)/libs:$CRYSTAL_PATH"
break
fi
@makenowjust
makenowjust / server.js
Created January 9, 2016 13:58
Smallest Git Server - this server can be cloned by `git clone http://localhost:2345` then create empty repository.
require('http').createServer((q,s)=>s.end('')).listen(2345)
@makenowjust
makenowjust / README.md
Last active February 22, 2016 10:34
最高の砂場

最高の砂場のロゴ

フォントは上のURLがNoto Sansで、下の文章がVL P Gothicです、多分。

ノートと鉛筆の画像はこちらより。CC0です。