Skip to content

Instantly share code, notes, and snippets.

View PatrickJS's full-sized avatar

PatrickJS PatrickJS

View GitHub Profile
@PatrickJS
PatrickJS / Future.js
Last active August 29, 2015 14:21 — forked from yelouafi/Future.js
/*
The MIT License (MIT)
Copyright (c) 2014
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@PatrickJS
PatrickJS / teachers-needed.md
Last active January 20, 2016 15:42 — forked from 1Marc/workshops-planning.md
Workshop Teachers Needed

Looking for workshop teachers to teach on the following topics!

For introductions please tweet @frontendmasters, @1marc or email: marc at FrontendMasters.com. Thanks!

You can propose other topics too.

Published blog post detailing topics and allowed people to vote on priority: 2015 Frontend Masters topic poll

JavaScript

@PatrickJS
PatrickJS / uri.js
Last active August 29, 2015 14:27 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@PatrickJS
PatrickJS / falcor-express-server-with-logging.js
Last active June 10, 2016 14:00 — forked from jimthedev/falcor-express-server-with-logging.js
Falcor with express featuring split route files and route access logging
// ...
// ... SNIP: You should include and wire up express as needed before this
// ...
// Falcor deps
var falcor = require('falcor');
var falcorExpress = require('falcor-express');
var bodyParser = require('body-parser');
// ROUTES
@PatrickJS
PatrickJS / falcorApp.jsx
Last active August 29, 2015 14:27 — forked from btholt/falcorApp.jsx
Falcor + React
const React = require('react');
const _ = require('lodash');
var model = new falcor.Model({
cache: {
movies: [
{
title: "Daredevil",
plot: "Marvel lol",
year: "2015-",
@PatrickJS
PatrickJS / browser.md
Last active January 20, 2016 15:23 — forked from defunctzombie/browser.md
browser field spec for package.json

The browser field is provided by a module author as a hint to javascript bundlers or component tools when preparing modules for client side use.

terms

Below are common terms used in the rest of the document

server

This is a non-dom based javascript execution environment. It usually only contains the base javascript language spec libraries and objects along with modules to communicate with OS features (available through commonjs require).

client

@PatrickJS
PatrickJS / fnv32a.js
Created October 2, 2015 04:05 — forked from vaiorabbit/fnv32a.js
FNV-1a Hash (http://isthe.com/chongo/tech/comp/fnv/) in JavaScript.
// 32 bit FNV-1a hash
// Ref.: http://isthe.com/chongo/tech/comp/fnv/
function fnv32a( str )
{
var FNV1_32A_INIT = 0x811c9dc5;
var hval = FNV1_32A_INIT;
for ( var i = 0; i < str.length; ++i )
{
hval ^= str.charCodeAt(i);
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
@PatrickJS
PatrickJS / latency.txt
Created October 6, 2015 05:58 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@PatrickJS
PatrickJS / README.md
Last active November 17, 2015 21:46 — forked from kentcdodds/README.md
Template for podbean episode for angular air

Paste this into this tool and make the necessary changes, then export as HTML and paste that into the podbean episode stuff.

Use this template for the title of the episode:

number ngAir - title

@PatrickJS
PatrickJS / making-javascript-faster.md
Created November 20, 2015 06:26
Making Javascript faster

Making Javascript faster

This is a list of guidelines to make your Javascript faster, often associated with jsPerf benchmarks.

Profile before optimizing

If you have an existing codebase, don't get carried away with premature optimizations. Profile to find the slow bits and pick the low hanging fruit.

Some of the latter lessons in Code School's Chrome DevTools course will teach you how to profile your code.