Skip to content

Instantly share code, notes, and snippets.

@x011
x011 / imacros-cheatsheet.md
Created October 7, 2016 12:07
iMacros Command, Variable, and function reference
@Restuta
Restuta / framework-sizes.md
Last active March 7, 2024 00:01
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@paulirish
paulirish / what-forces-layout.md
Last active April 16, 2024 17:32
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
@xjamundx
xjamundx / blog-webpack-2.md
Last active January 4, 2023 01:45
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@brittanydionigi
brittanydionigi / sw-messaging.js
Created March 16, 2015 19:41
messaging in service workers
// index.html -- Sending message TO service worker, FROM page:
navigator.serviceWorker.controller.postMessage(message);
// service-worker.js -- Handling message event in service worker by posting a message back to the page:
self.addEventListener('message', function(event) {
self.clients.matchAll().then(function(client) {
client[0].postMessage({
command: 'logMessage',
error: null,
message: 'hi there message here!!'
@jbgutierrez
jbgutierrez / plot-graphviz.rb
Last active August 29, 2015 14:15
Plotting a dependency graph
#!/usr/bin/env ruby
# coding: UTF-8
require 'yaml'
ALIAS = {
text: '/vendor/requirejs-text/text',
jquery: '/vendor/jquery/dist/jquery',
dust: '/vendor/dustjs-linkedin/dist/dust-full',
dustHelpers: '/vendor/dustjs-linkedin-helpers/dist/dust-helpers',
pagejs: '/vendor/page.js/page',
@tagr
tagr / server.js
Created September 28, 2014 20:22
Node.js/Express: Add Expires header to /images and /stylesheets directories
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
@mmcgahan
mmcgahan / gist:9fa045d98c7c122f1c0b
Created June 18, 2014 19:09
Handlebars template inheritance
# Template composition with inclusion
Every template language I have seen provides some mechanism for one template to include another, thus supporting the reuse of repeated elements like headers and footers. The included templates are called partials in Mustache parlance:
```html
<!-- home.hbs -->
<html>
<body>
{{> header}}
<p> HOME </p>
{{> footer}}
@jbgutierrez
jbgutierrez / setup-continuous-deployment-ubuntu-12.10-x86_64.sh
Last active December 27, 2015 07:59
Self-contained bash script to setup continuous deployment for nodejs apps built on top of ubuntu, git and foreman
DEPLOYER='deployer'
DEPLOYER_HOME="/home/$DEPLOYER"
PROJECT_NAME='node-js-sample'
PROJECT_REPO='https://github.com/heroku/node-js-sample.git'
# Provisining an ubuntu server
apt-get -y update
apt-get -y upgrade
apt-get -y install software-properties-common
add-apt-repository ppa:chris-lea/node.js
var express = require('express');
var app = express();
var port = process.env.PORT || 5000;
var request = require('request');
var zlib = require('zlib');