Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jimmont's full-sized avatar

Jim Montgomery jimmont

View GitHub Profile
@spiralx
spiralx / computed-property.js
Created January 26, 2016 18:56
Use ES6 Proxy to attach computed properties
'use strict';
const VALUE = Symbol.for('value')
function addComputedProperty(obj, name, func) {
let _computed = func(obj)
return new Proxy(obj, {
get(target, key, receiver) {
if (key === name) {
@davestevens
davestevens / LetsEncrypt.md
Last active March 28, 2024 10:35
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
@philsinatra
philsinatra / css-system-fonts.css
Created October 29, 2015 13:41
CSS System Fonts
/* https://medium.com/@mwichary/system-shock-6b1dc6d6596f#.pth6mnqx0 */
font-family: -apple-system, ".SFNSText-Regular", "San Francisco", "Oxygen", "Ubuntu", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
@paulirish
paulirish / what-forces-layout.md
Last active April 23, 2024 11:02
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ebidel
ebidel / object-observe-proxy-polyfill.js
Last active July 29, 2021 04:08
Object.observe() polyfill using ES6 Proxies (POC)
// An `Object.observe()` "polyfill" using ES6 Proxies.
//
// Current `Object.observe()` polyfills [1] rely on polling
// to watch for property changes. Proxies can do one better by
// observing property changes to an object without the need for
// polling.
//
// Known limitations of this technique:
// 1. the call signature of `Object.observe()` will return the proxy
// object. The original object needs to be overwritten with this return value.
@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active March 19, 2024 02:11
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@remy
remy / peek.js
Last active August 29, 2015 14:23
Is this okay? The peek will just act as a benign through stream letting us see the first item. Would this add much overhead to the time do you think?
var peek = module.exports = function (fn) {
var peeked = false;
return through(function write(data) {
this.emit('data', data);
if (peeked) {
return;
}
peeked = true;
var stream = this;
var cont = function (end) {
@hallahan
hallahan / featuresAt-mapbox-gl-js.md
Last active May 8, 2016 14:08
I'm going through the code execution of `featuresAt` in Mapbox GL JS. This is to take notes and understand how all of this works.

How FeaturesAt Works in MapboxGL JS

I'm going through the code execution of featuresAt in Mapbox GL JS. This is to take notes and understand how all of this works.

Initiating the feature search based on the example on Mapbox GL API Docs...

map.on('click', function(e) {
var Bar1 = base => class extends base {
componentWillMount(){
super.componentWillMount();
console.log('Bar1');
}
};
var Bar2 = base => class extends base {
componentWillMount(){
super.componentWillMount();
@vesse
vesse / express-jwt.js
Last active April 11, 2023 16:43
Two Passport + JWT (JSON Web Token) examples
//
// Implementation using express-jwt middle
//
var express = require('express'),
ejwt = require('express-jwt'),
jwt = require('jsonwebtoken'),
passport = require('passport'),
bodyParser = require('body-parser'),
LocalStrategy = require('passport-local').Strategy,
BearerStrategy = require('passport-http-bearer').Strategy;