Skip to content

Instantly share code, notes, and snippets.

:octocat:
_

Paul Miller paulmillr

:octocat:
_
View GitHub Profile
@paulmillr
paulmillr / commonjs-test.js
Created Jun 20, 2012
Quick and dirty test for commonjs modules
View commonjs-test.js
var mocha = require('mocha');
var chai = require('chai');
var expect = chai.expect;
var window = {};
var w = window;
// Require definition.
@paulmillr
paulmillr / scroll-listener.js
Created Jul 15, 2012
60FPS onscroll event listener
View scroll-listener.js
(function() {
var lastScrollY = 0;
var ticking = false;
var update = function() {
// do your stuff
ticking = false;
};
var requestTick = function() {
@paulmillr
paulmillr / type-inference.coffee
Created Jul 17, 2012
Damas-Hindley-Milner type inference algorithm in LiveScript
View type-inference.coffee
# Algorithm W (Damas-Hindley-Milner) in LiveScript.
# By Paul Miller (paulmillr.com), Public domain.
#
# Based on Robert Smallshire's [Python code](http://bit.ly/bbVmmX).
# Which is based on Andrew's [Scala code](http://bit.ly/aztXwD).
# Which is based on Nikita Borisov's [Perl code](http://bit.ly/myq3uA).
# Which is based on Luca Cardelli's [Modula-2 code](http://bit.ly/Hjpvb).
# Something like that.
prelude = require './prelude'
@paulmillr
paulmillr / fp-ct.md
Created Jul 25, 2012
Functional programming terms described by category theory
View fp-ct.md
  • Monad is a monoid in the category of endofunctors.
  • Lens is exactly the Coalgebra for the CoState Comonad.
  • Iteratee is a standard stream fusion hylomorphism stuff with a left fold.
@paulmillr
paulmillr / vk-helpers.js
Last active Oct 9, 2015
VK.com JS / LiveScript helpers
View vk-helpers.js
var queryAll = function(selector) {
return [].slice.call(document.querySelectorAll(selector));
};
// 1. Open album.
// 2. Execute code in console.
// 3. Press → button until the end of the album
// 4. Then execute `printLinks();`, copy the output and pass it to wget.
var addAlbumPhotoLinks = function() {
var links = [];
@paulmillr
paulmillr / brunch-heroku-deploy.md
Last active Mar 29, 2019
Build & deploy brunch applications on Heroku.
View brunch-heroku-deploy.md
  1. Add to .gitignore:

    node_modules
    public
    
  2. Add to your app dependencies of package.json:

@paulmillr
paulmillr / Gruntfile.js
Created Sep 11, 2012
yeoman default config
View Gruntfile.js
module.exports = function( grunt ) {
'use strict';
//
// Grunt configuration:
//
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
//
grunt.initConfig({
// Project configuration
@paulmillr
paulmillr / less2stylus.coffee
Created Oct 17, 2012 — forked from LabiKyo/less2stylus.coffee
Convert Less to Stylus for general purpose
View less2stylus.coffee
replacements = [
# Remove opening brackers.
[/^(\ *)(.+)\ +\{\ *\n?\ */mg, '$1$2\n$1 '],
[/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, '$1$2\n$1 '],
[/\ *\{\ *\n*/g, '\n'],
# Remove closing brackets.
[/\ *\}\ *\n*/g, '\n'],
# Remove semicolons.
@paulmillr
paulmillr / safari-web-inspector.md
Last active Oct 12, 2015
Safari web inspector evolution
View safari-web-inspector.md

As a developer, i’m curious what happens to tools I use. Some time ago I decided to log all changes in web inspectors of browsers.

So far list includes only Safari and Firefox primarly because it’s easy to track their changes. In the future other browsers will be in too.

Safari web inspector evolution

  • August 2012: Initial release of new safari web inspector. It had terrible UI / UX.
  • October:
    • Reduced main panels count from 8 to 3-4.
  • November:
@paulmillr
paulmillr / github-languages-stats.json
Last active May 5, 2020
Most active GitHub users raw data
You can’t perform that action at this time.