Skip to content

Instantly share code, notes, and snippets.

View kimmobrunfeldt's full-sized avatar

Kimmo Brunfeldt kimmobrunfeldt

View GitHub Profile
@kimmobrunfeldt
kimmobrunfeldt / ga-error.js
Last active August 29, 2015 14:16
Google Analytics error reporting skeleton. NOTE THAT THIS DOES NOT WORK!!! This is just an example how to hook to window.onerror
function sendErrorToAnalytics(err) {
console.log('Sending error to analytics', err);
// WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Google analytics exception's exDescription max length is 150 bytes.
// USE ANOTHER EXCEPTION LOGGING SERVICE IF YOU NEED TO LOG E.G. STACKTRACES
ga('send', 'exception', {
exDescription: err.stack,
fatal: false
});
@kimmobrunfeldt
kimmobrunfeldt / wrap.md
Created January 23, 2015 00:10
Space Tyckiting pre-problem summary

Space Tyckiting Sign Up Problem

For the Space Tyckiting event, students had to solve a small problem at the sign up. Bonus points were awarded for creativity.

If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Your task is to **write a function** which finds the sum of all the
multiples of 3 or 5 below 1000.
// Return operations to modify array a to b.
// e.g. var a = [{id:1}, {id:2}], b = [{id:2}]
// operations(a, b) -> [{operation: ‘remove’, item: {id:1}]
function operations(a, b) {
var aIds = _.pluck(a, 'id');
var bIds = _.pluck(b, 'id');
var notInBoth = _.xor(aIds, bIds);
return _.map(notInBoth, function(id) {
var isInA = _.contains(aIds, id);
@kimmobrunfeldt
kimmobrunfeldt / install.md
Last active August 29, 2015 14:10
Parse HTML table

Install

  • Install http://nodejs.org/
  • Save parse-table.js to your Downloads folder
  • Open Terminal application
  • Enter command cd Downloads
  • Enter command node parse-table.js

Now output.csv is in your Downloads folder.

@kimmobrunfeldt
kimmobrunfeldt / index.html
Created November 29, 2014 12:01
Example of progressbar.js
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ProgressBar.js - Minimal Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.progress {
@kimmobrunfeldt
kimmobrunfeldt / index.html
Created November 29, 2014 11:53
Chartist.js example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Chartist</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/gionkunz/chartist-js/master/dist/chartist.min.css">
@kimmobrunfeldt
kimmobrunfeldt / index.html
Created November 29, 2014 11:29
Particles.js example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Particles</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#particles {
// Usage:
// npm install underscore
// node timeline.js
var _ = require('underscore');
var TimelineGrid = (function(options) {
/*
Module to help positioning boxes on a vertical timeline.
Boxes are added as tightly as possible while keeping chronological
@kimmobrunfeldt
kimmobrunfeldt / 0-osx-for-web-development.md
Last active July 26, 2022 13:30
Install web development tools to Mavericks (OS X 10.9)

Install web development tools to Mavericks (OS X 10.9)

Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.

I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).

These are my opinions. Read this document through and pick up the good parts to your preferences.

System preferences