Skip to content

Instantly share code, notes, and snippets.

View joaocunha's full-sized avatar
Web Performance

João Cunha joaocunha

Web Performance
View GitHub Profile
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@joaocunha
joaocunha / .gitconfig
Last active August 29, 2015 14:14 — forked from L2G/.gitconfig
[url "git@github.com:L2G/"]
insteadOf = "github:///L2G/"
insteadOf = "http://github.com/L2G/"
insteadOf = "https://github.com/L2G/"
[url "https://github.com/"]
insteadOf = "github:///"
insteadOf = "http://github.com/"
@joaocunha
joaocunha / makeapp.sh
Last active August 29, 2015 14:14 — forked from eerne/makeapp.sh
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@joaocunha
joaocunha / makeapp.sh
Last active August 29, 2015 14:14 — forked from eerne/makeapp.sh
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@joaocunha
joaocunha / vunit_example.html
Last active February 4, 2016 18:58
vUnit.js example
<head>
<!-- Add vUnit.js to the head if you want to avoid FOUC -->
<script src="path/to/vunit.js"></script>
<!-- Instantiate vUnit.js passing a CSSMap with properties you want to play with -->
<script>
new vUnit({
CSSMap: {
// The selector (vUnit will create rules ranging from .selector1 to .selector100)
'.vh_height': {
@joaocunha
joaocunha / vars.styl
Created December 11, 2014 22:09
Stylus Vars used on the MDN Kuma project
/* vendors */
/* - this is a global variable set by stylus to 'moz webkit o ms official' by default
- as far as I can tell it only uses it for @keyframes
- and they're going to remove it in 1.0
- anyway, we get csslint errors if ms is in this list
*/
vendors = webkit official;
/* our custom variable for prefixing */
VENDOR-PREFIXES = '-webkit-' '-moz-' '-ms-';
/* custom list of properties and their valid prefixes for vendors we support */
@joaocunha
joaocunha / stylus-mixins-mdn.styl
Created December 11, 2014 22:07
Stylus Mixins used on the MDN Kuma project
@require 'vars';
@require 'prefixes';
/*
Provides man mixins for use within the MDN theme.
*/
/* searches expression for the provided string and replaces with provided value */
replace($expr, $str, $val) {
$expr = clone($expr);
@joaocunha
joaocunha / pre-commit
Last active August 29, 2015 14:10 — forked from iamdustan/pre-commit
#!/bin/bash
# Prevent commits against the 'master' branch
if [[ `git rev-parse --abbrev-ref HEAD` == 'master' ]]
then
echo 'You cannot commit to the master branch!'
echo 'Stash your changes and apply them to another branch, using:'
echo 'git stash'
echo 'git checkout <branch>'
echo 'git stash apply'
@joaocunha
joaocunha / pre-commit
Last active August 29, 2015 14:10 — forked from Simbul/pre-commit
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]