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
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++) {
.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() {
@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 / 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)

@teropa
teropa / minicompiler.js
Created May 9, 2015 18:02
Code for "Inside The AngularJS Directive Compiler"
'use strict';
function $CompileProvider($provide) {
var directives = {};
this.directive = function(name, factory) {
if (!directives.hasOwnProperty(name)) {
directives[name] = [factory];
$provide.factory(
@teropa
teropa / frontend_ops.md
Created November 11, 2014 10:19
Why Frontend Needs Ops - Resources
@teropa
teropa / no_migration_path.md
Last active August 29, 2015 14:08
Angular 2.0's "No Migration Path": A Story in Three Acts

Act 1

Igor Minar at ng-europe, October 23:

Once 2.0 is ready, then we’ll figure out what’s the best way to migrate. At this point we’re really trying to create the best 2.0 ever, and once we know what that is, we’ll go back and see what is the best migration path. Because if we run it the other way around, that would constrain what we can do with 2.0.

Act 2

David Iffland, InfoQ, October 27: