Skip to content

Instantly share code, notes, and snippets.

View teropa's full-sized avatar

Tero Parviainen teropa

View GitHub Profile
I am attesting that this GitHub handle teropa is linked to the Tezos account tz1a8QAsN41uTUapsg6dDAf9kPBMFnDM5fmY for tzprofiles
sig:edsigtjNUSiRXUf1D5DyeU44VYtsjMqvEYRFomtF3NoG4Domw9bPhU274mnvG1n7Yzy2wQt7Yiq1piyFB6wgy6yW9eoJEC8QQic
@teropa
teropa / life.cljs
Created November 3, 2015 09:57
Conway's Life in ClojureScript
;; Credits:
;;
;; * ClojureScript
;; * Reagent https://reagent-project.github.io/
;; * Figwheel https://github.com/bhauman/lein-figwheel
;; * core.async https://clojure.github.io/core.async/
;; * Christophe Grand's Life implementation http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/
(ns life.core
(:require [reagent.core :as r]
@teropa
teropa / resources.md
Last active December 4, 2020 05:42
Clojure Resources

Tutorials

@teropa
teropa / spec_helper.rb
Created November 30, 2012 14:16
Combine the Rails 3.2 tagged logger with rSpec around hooks -> See which spec did each query in test.log
config.around(:each) do |example|
Rails.logger.tagged(example.metadata[:full_description]) do
example.run
end
end
function peakNormalize(arr) {
let peakHigh = 0,
peakLow = 0;
for (let i = 0; i < arr.length; i++) {
peakHigh = Math.max(peakHigh, arr[i]);
peakLow = Math.min(peakLow, arr[i]);
}
if (peakHigh > 0.7 || peakLow < -0.7) {
let ratio = Math.max(peakHigh, -peakLow) / 0.7;
for (let i = 0; i < arr.length; i++) {
@teropa
teropa / reactive2015_gol.md
Created September 24, 2015 15:56
ClojureScript Game of Life - Reactive 2015 Lightning Talk Proposal

In my proposed lightning talk for the Reactive Conference, I'll create Conway's Game of Life in ClojureScript, and I'll do it in five minutes. I'll use an interactive programming workflow enabled by Figwheel. Each piece will be added into the running application without reloading the page.

If you want to see a little cellular lifeform spawn out of nothing into an running web browser window, I'd appreciate it if you starred this Gist!

Cheers,

(@teropa)

.selected {
background-color: #CFD8DC !important;
color: white;
}
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
var HEROES: Hero[] = [
{ "id": 11, "name": "Mr. Nice" },
{ "id": 12, "name": "Narco" },
{ "id": 13, "name": "Bombasto" },
{ "id": 14, "name": "Celeritas" },
{ "id": 15, "name": "Magneta" },
{ "id": 16, "name": "RubberMan" },
{ "id": 17, "name": "Dynama" },
{ "id": 18, "name": "Dr IQ" },
{ "id": 19, "name": "Magma" },
@teropa
teropa / phones.service.spec.js
Created January 25, 2016 14:36
A2 ES5 spec
'use strict';
// Unpack NG2 Jasmine wrappers
var describe = ng.testing.describe,
beforeEach = ng.testing.beforeEach,
beforeEachProviders = ng.testing.beforeEachProviders,
inject = ng.testing.inject,
it = ng.testing.it;
describe('Phones', function() {
/*
* call-seq:
* Rugged::Repository.new(name, options = {}) -> repository
*
* Open a Git repository with the given +name+ and return a +Repository+ object
* representing it.
*
*/
static VALUE rb_git_repo_new(int argc, VALUE *argv, VALUE klass)
{