Skip to content

Instantly share code, notes, and snippets.

View kimmobrunfeldt's full-sized avatar

Kimmo Brunfeldt kimmobrunfeldt

View GitHub Profile
@kimmobrunfeldt
kimmobrunfeldt / node-exports-styles.js
Last active July 1, 2023 18:39
A few Node module export styles. 1 seems to be the most used and I prefer it
// Style 1
// Export all manually
// Good: Calling functions inside the module is convenient
// Bad: module.exports becomes verbose and it's tedious to add new functions
function a() {
b()
}
@kimmobrunfeldt
kimmobrunfeldt / hwoteams.js
Last active August 29, 2015 13:59
Parse http://hwo.azurewebsites.net/, show only subset of teams and write output to file
// Install:
// npm install lodash request cheerio
// Usage:
// nodejs hwoteams.js
var request = require('request')
, cheerio = require('cheerio');
var fs = require('fs');
var _ = require('lodash');
// Example of creating wrapper function using `arguments`
function add(a, b) {
return a + b;
}
// Example call:
// > verboseAdd(1, 2);
// Calculating 1 + 2
// < 3
@kimmobrunfeldt
kimmobrunfeldt / underscore-debounce-example.js
Created May 2, 2014 14:51
Example of using Underscore's _.debounce function
// Example of using Underscore's _.debounce function
// debounce is useful for situations where you get multiple events fired
// from one action. For example resize event is sent multiple times when
// window is resized
var reloadIfResizeChange = _.debounce(function() {
window.location.reload();
}, 200);
window.addEventListener('resize', reloadIfResizeChange);
@kimmobrunfeldt
kimmobrunfeldt / 0-audio-support-mobile-ie.md
Last active August 29, 2015 14:01
Summary of audio/media support in Windows Phones' Internet Explorer(versions 9-11)
@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

// 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 / 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 {
@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 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 {