Skip to content

Instantly share code, notes, and snippets.

View nvbn's full-sized avatar

Vladimir Iakovlev nvbn

View GitHub Profile
@nvbn
nvbn / core.cljs
Created June 28, 2015 14:54
vr with cljs
(ns vr-cljs.core)
(enable-console-print!)
(defn get-camera
"Creates camera with desired aspect ratio."
[]
(doto (js/THREE.PerspectiveCamera. 75 (/ (.-innerWidth js/window)
(.-innerHeight js/window))
0.1 1000)
@nvbn
nvbn / core.cljs
Created June 23, 2015 15:14
rerenderer samples
(ns ^:figwheel-always rerenderer.examples.core
(:require-macros [cljs.core.async.macros :refer [go-loop go]])
(:require [cljs.core.async :refer [chan <! timeout]]
[rerenderer.examples.bird :as b]
[rerenderer.core :as r :include-macros true]
[rerenderer.browser :refer [browser]]))
(enable-console-print!)
(defn rotating-rectangle
@nvbn
nvbn / profile.py
Created June 19, 2015 14:02
wwconfig
from .base import BaseConfig
class Config(BaseConfig):
DEBUG = True
ASSETS_DEBUG = True
CSRF_ENABLED = False
FALLBACK_TO_PRODUCTION_IMAGES = True
SERVER_NAME = 'localhost:5000'
@nvbn
nvbn / core.cljs
Created May 28, 2015 01:31
svg animation
(ns ^:figwheel-always svg-image-example.core
(:require-macros [cljs.core.async.macros :refer [go-loop]])
(:require [cljs.core.async :refer [<! timeout]]
[om.core :as om :include-macros true]
[om-tools.core :refer-macros [defcomponent]]
[om-tools.dom :as dom]))
(enable-console-print!)
(defcomponent rotated-rect-rect
@nvbn
nvbn / core.clj
Created May 24, 2015 21:11
svg-image-example
(ns svg-image-example.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom]))
(defn image
[{:keys [href x y width height]} _]
(reify
om/IRender
(render [_]
(let [html (str "<image x='" x "' y='" y "'"
@nvbn
nvbn / python_collections_sucks.py
Last active August 29, 2015 14:20
python_collections_sucks.py
# python 3:
In [1]: a = {'x': 10, 'y': 50}
In [2]: b = {'a': 5, 'c': 12}
In [3]: a.keys() + b.keys()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-5b3174d08fb5> in <module>()
----> 1 a.keys() + b.keys()
@nvbn
nvbn / bf_2.clj
Last active June 19, 2021 12:29
bf_2.clj
(ns bf.core)
(defmulti run-symbol
(fn [symbol _] symbol))
(defmethod run-symbol \+
[_ {:keys [pos] :as state}]
(update-in state [:stack pos] inc))
(defmethod run-symbol \-
# Originally: https://raw.githubusercontent.com/khenderick/micropython-drivers/master/ssd1306/ssd1306.py
# The MIT License (MIT)
#
# Copyright (c) 2014 Kenneth Henderick
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
(ns bf.core)
(defn bf>
[[stack current]]
(let [new-current (inc current)]
[(if (>= new-current (count stack))
(conj stack 0)
stack)
new-current]))
@nvbn
nvbn / main.py
Last active August 29, 2015 14:11
pyboard uasyncio CPS example
from uasyncio.core import get_event_loop
from ssd1306 import get_display
from ultrasonic import get_ultrasonic
from utils import get_gyro, alts
def main():
display = get_display(pinout={'sda': 'Y10',
'scl': 'Y9'},
height=64,