Skip to content

Instantly share code, notes, and snippets.

Avatar

Tero Parviainen teropa

View GitHub Profile
View tezos.txt
I am attesting that this GitHub handle teropa is linked to the Tezos account tz1a8QAsN41uTUapsg6dDAf9kPBMFnDM5fmY for tzprofiles
sig:edsigtjNUSiRXUf1D5DyeU44VYtsjMqvEYRFomtF3NoG4Domw9bPhU274mnvG1n7Yzy2wQt7Yiq1piyFB6wgy6yW9eoJEC8QQic
View peaknormalize.js
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++) {
View tour-of-heroes.component.css
.selected {
background-color: #CFD8DC !important;
color: white;
}
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
View heroes.ts
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" },
View phones.service.spec.js
'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 Nov 3, 2015
Conway's Life in ClojureScript
View life.cljs
;; 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 Sep 24, 2015
ClojureScript Game of Life - Reactive 2015 Lightning Talk Proposal
View reactive2015_gol.md

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
Code for "Inside The AngularJS Directive Compiler"
View minicompiler.js
'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 Nov 11, 2014
Why Frontend Needs Ops - Resources
View frontend_ops.md
@teropa
teropa / no_migration_path.md
Last active Aug 29, 2015
Angular 2.0's "No Migration Path": A Story in Three Acts
View no_migration_path.md

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: