Skip to content

Instantly share code, notes, and snippets.

View chooblarin's full-sized avatar

Sota Hatakeyama chooblarin

View GitHub Profile
@chooblarin
chooblarin / 1d-cellular-automaton.markdown
Created September 7, 2018 18:52
1D Cellular Automaton
@chooblarin
chooblarin / 1-dimensional-reaction-diffusion-simulation-with-d3-js.markdown
Created September 2, 2018 07:21
1-dimensional reaction-diffusion simulation with D3.js
@chooblarin
chooblarin / 1-dimensional-reaction-simulation-with-d3-js.markdown
Created September 2, 2018 07:21
1-dimensional reaction simulation with D3.js
@chooblarin
chooblarin / 1-dimensional-diffusion-simulation-with-d3-js.markdown
Created September 2, 2018 07:06
1-dimensional diffusion simulation with D3.js
void setup() {
size(500, 500);
background(255);
}
void draw() {
float centerX = width / 2.0;
float centerY = height / 2.0;
float faceSize = 200.0;
import 'pixi.js'
import {
GlowFilter
} from '@pixi/filter-glow'
import noiseMap from "../assets/images/noise_map.png"
function startApp() {
const app = new PIXI.Application({
width: 800.0,
class Fireball {
constructor(position, velocity, size) {
this.position = position
this.velocity = velocity
this.size = size
this.acceleration = createVector(0, 0)
this.radius = size / 2
this.mass = this.size / 100
this.lifespan = 50
@chooblarin
chooblarin / BeatDetector.js
Created July 17, 2017 04:41
Beat Detector
class BeatDetector {
constructor(holdTime, decayRate, minLevel) {
this.holdTime = holdTime // the number of frames to hold a beat
this.decayRate = decayRate
this.minLevel = minLevel // a volume less than this is no beat
this.cutOff = 0.0
this.time = 0
}
@chooblarin
chooblarin / RxSandbox.swift
Last active May 5, 2017 04:16
Playing with RxSwift Scheduler
import UIKit
import RxSandbox
import RxSwift
import PlaygroundSupport
func which() -> String {
return Thread.isMainThread ? "main" : "background"
}
let disposeBag = DisposeBag()
defmodule Prac2 do
def prime?(2) do true end
def prime?(n) when n < 2 do false end
def prime?(n) when rem(n, 2) == 0 do false end
def prime?(n) do check(3, n) end
defp check(a, b) do
if a * a <= b do
if rem(b, a) == 0 do
false