Skip to content

Instantly share code, notes, and snippets.

View nbeloglazov's full-sized avatar

Mikita Belahlazau nbeloglazov

View GitHub Profile
@nbeloglazov
nbeloglazov / flipping.clj
Created July 20, 2017 03:38
Flipping drawing
(ns test.core
(:require [quil.core :as q]))
(defn draw []
(q/background 255)
(q/fill 0)
(q/with-translation [(/ (q/width) 2)
(/ (q/height) 2)]
(q/apply-matrix
@nbeloglazov
nbeloglazov / README.md
Last active April 12, 2017 06:25
Example of using Processing.selectInput() from Quil.
@nbeloglazov
nbeloglazov / longtask.clj
Created April 5, 2017 06:03
Example of using long-running background tasks with Quil. Quil's UI thread only displays data while background task perform CPU-intensive work (multiplying matrices) without blocking UI thread.
(ns longtask.core
(:require [quil.core :as q]
[quil.middleware :as m]))
; This program shows an example how to integrate long-running
; background tasks into Quil sketch. Clicking on the left or
; right half of the screen starts a new background task which does following:
; 1. Generates random square matrix of size rand of [100, 200, 500, 1000]
; 2. Multiplies matrix by itself. During the multiplication background thread
; updates (:progress state) value so Quil can display the progress.
@nbeloglazov
nbeloglazov / play_all_audio_files.js
Last active December 11, 2016 20:32
Script for Rachel's English site to play all audio recordings in soundboards session. Each recording will be played 3 times with pauses for you to repeat. How to use: 1. go to page with audio recordings 2. in url type "javascript:" and paste this script after colon 3. hit enter, it should start playing recordings one by one
function playAndWait(el) {
return new Promise((resolve) => {
el.play().then(() => {
setTimeout(resolve, (el.duration * 2.5) * 1000);
});
});
}
function swapEveryPair(els) {
const elements = Array.from(els);
(defproject drawing "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[quil "2.4.0"]])
From 3e49631e23f20c784fe70fc0d76bb3a58c4b8da6 Mon Sep 17 00:00:00 2001
From: Nikita Beloglazov <nikelandjelo@gmail.com>
Date: Sat, 12 Mar 2016 11:35:10 -0800
Subject: [PATCH] Optimize dump. Reduces size of optimizations SIMPLE binary
from 6.4M to 2.7M
---
src/main/cljs/cljs/js.clj | 2 +-
src/main/cljs/cljs/js.cljs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
(ns my.core
(:require [cljs.nodejs :as nodejs]
cljs.js
[clojure.string :as cstr]))
(nodejs/enable-util-print!)
(def bar-source
"(ns my.bar)
@nbeloglazov
nbeloglazov / instructions.md
Last active August 29, 2015 14:13
Setting up Hatnik to automatically update version in README
  1. Login to http://hatnik.com
  2. Click "Add action".
  3. Enter library.
  4. Change action type to Pull Request.
  5. Enter you repository.
  6. Setup pull request operation: file=README.md, regex={{library}} "[^"]+", replacement={{library}} "{{version}}".
  7. Test pull request if you want to. It will open pull request using "2.3.4" as "new" version for the library. To test pull request use "Test" button.
  8. Click "Create".

Note: Hatnik will not open pull request if version in README is correct, only if you forget to update it next time you do release.

(ns sandbox.core
(:use [incanter core io charts]))
(use '[incanter core io charts])
(def data (read-dataset "http://xweb.geos.ed.ac.uk/~weather/jcmb_ws/JCMB_2014_Oct.csv" :header true))
(def head-data (head 10 data))
@nbeloglazov
nbeloglazov / packer.clj
Last active March 7, 2023 06:49
Creates fat jar for jogl and gluegen.jar.
(ns quil-utils.packer
(:require [cemerick.pomegranate.aether :as p]
[clojure.java.io :as io])
(:import [java.util.zip ZipFile ZipEntry ZipOutputStream]
org.apache.commons.io.IOUtils))
(defn jars [artifact version]
(->> [[artifact version]]
(p/resolve-dependencies :repositories {"JogAmp" "https://jogamp.org/deployment/maven/" "central" "https://repo1.maven.org/maven2/"} :coordinates)