Skip to content

Instantly share code, notes, and snippets.

View niklas-r's full-sized avatar
:shipit:
Shipping code, all day, `err` day

Niklas Kahn niklas-r

:shipit:
Shipping code, all day, `err` day
  • Neat Minds
  • Sweden, Stockholm
View GitHub Profile
@niklas-r
niklas-r / userTimingMiddleware.js
Created July 3, 2018 19:45 — forked from vcarl/userTimingMiddleware.js
A User Timing middleware for redux to create performance markers for dispatched actions
const userTiming = () => (next) => (action) => {
if (performance.mark === undefined) return next(action);
performance.mark(`${action.type}_start`);
const result = next(action);
performance.mark(`${action.type}_end`);
performance.measure(
`${action.type}`,
`${action.type}_start`,
`${action.type}_end`,
);

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@niklas-r
niklas-r / flexbox.scss
Created June 30, 2017 10:30 — forked from richardtorres314/flexbox.scss
CSS Flexbox - Sass Mixins
// --------------------------------------------------
// Flexbox SASS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
@niklas-r
niklas-r / spec_helper.coffee
Created January 7, 2016 15:17 — forked from todoubled/spec_helper.coffee
JSDOM/jasmine
window = {} unless window?
global.$=require('jquery') unless jQuery?
global._=require('underscore') unless _?
global.Backbone=require('backbone') unless Backbone?
global.Mustache=require('../lib/mustache') unless Mustache?
global.localStorage=require('localStorage') unless localStorage?
global.Store=require('../lib/backbone.localStorage') unless Store?
global.jsdom = require("jsdom").jsdom
global.document = jsdom('<html><body></body></html>')
global.window = document.createWindow()
@niklas-r
niklas-r / main.js
Last active August 29, 2015 14:28
Argument object with default properties and values in ES2015
function f({a = "I'm A", b = "I'm B"} = {}) {
console.log(a); // >"I'm C"
console.log(b); // >"I'm B"
}
f({ a: "I'm C" });
@niklas-r
niklas-r / SublimeLinter.sublime-settings
Created July 1, 2015 14:19
My SublimeLinter settings
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"jshint": {
@niklas-r
niklas-r / scopes.txt
Last active August 29, 2015 14:21 — forked from iambibhas/scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@niklas-r
niklas-r / links.txt
Created December 12, 2014 07:24 — forked from antila/links.txt
node-webkit links
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^.*\S+.*$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
@niklas-r
niklas-r / index.html
Created May 16, 2014 07:45
AngularJS stop event directive. Used to stopPropagation in AngularJS. Thanks to http://stackoverflow.com/a/14547223
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="UTF-8">
<title>Stop Events</title>
</head>
<body ng-controller="appCtrl">
<div ng-click="doSomething()">
<p>Hey!</p>
<div ng-click="doSomethingElse()" stop-event="click">