Skip to content

Instantly share code, notes, and snippets.

@xl1
xl1 / numdot.scm
Created February 8, 2014 05:16
れんしゅう
(define (range low high)
(if (> low high)
()
(cons low (range (+ low 1) high))))
(define (flatmap func seq)
(if (null? seq)
()
(append (func (car seq)) (flatmap func (cdr seq)))))
@xl1
xl1 / source.glsl
Created February 21, 2014 16:19
GLSL AST の絵をかく
fs = require 'fs'
tokenizer = require 'glsl-tokenizer'
parser = require 'glsl-parser'
through = require 'through'
{ exec } = require 'child_process'
transform = (node) ->
result = []
walk = (n, path) =>
path += '/' + n.id
/* for new UI (2014/4) */
.AppContent-main > .Grid--withGutter > :first-child {
position: sticky;
top: 40px;
}
.ProfileTweet {
padding: 8px 12px;
}
@xl1
xl1 / gist:11181457
Created April 22, 2014 14:32
Google 検索で JK 使えるようにするやつ (Chrome で espv 付いてると使えなくなってる (2014/4/22 36.0.1941.0 dev-m))
`
// ==UserScript==
// @match https://www.google.com/*
// @run-at document-end
// ==/UserScript==
`
links = document.querySelectorAll '.r > a'
index = 0
@xl1
xl1 / gist:1a38373cbb750036b56c
Last active August 29, 2015 14:01
GitHub Pages を Travis に build & deploy させるようにした

GitHub Pages を Travis に build & deploy させるようにした

GerberaGitHub pages を Travis に任せることにしたのでメモしとく

clone

Travis, 最初に git clone --branch=master して、 master ブランチだけを持ってくることになっている。 gh-pages ブランチもほしいので .travis.yml

git fetch origin gh-pages:gh-pages
require 'harmony-reflect'
LazilyExtensible = (obj) ->
switch typeof obj
when 'object', 'function'
Proxy obj,
get: (target, name) ->
if target[name] is undefined
target[name] = LazilyExtensible {}
else
@xl1
xl1 / gist:a1383a57c5ca6811f158
Last active August 29, 2015 14:03
Math にあるけど GLSL でサポートされていないの何
gl = new MicroGL
for name in Object.getOwnPropertyNames(Math)
if typeof Math[name] is 'function'
args = ("0.0" for _ in [1..Math[name].length])
shader = gl._initShader gl.gl.FRAGMENT_SHADER, """
precision mediump float;
void main(){
float result = #{name}(#{args.join()});
}
@xl1
xl1 / gist:4955d25341a18265702b
Last active August 29, 2015 14:04
イメージ
<script type="text/azalea-coffee">
azalea = require 'azalea'
mongo = require 'mongo-wrapper'
azalea.events.start = ->
mongo.connect()
.then (db) -> db.productCategory.find()
.then (categories) ->
azalea.models.condition.categories = categories
api = require('./urlmapper')('https://api.example.com/v1')
api.users.GET(limit: 1)
.then ([user]) ->
console.log user.name, user.age
api.users[user.id].posts.GET()
.then (posts) ->
posts.forEach ({ content }) -> console.log content
@xl1
xl1 / gist:de5b20204d5630367ed2
Created October 6, 2014 14:30
srcdoc 便利事例
html = '
<!doctype html>
<title>test</title>
<body>
foo bar
</body>
'
ifr = document.createElement 'iframe'
document.body.appendChild ifr