Skip to content

Instantly share code, notes, and snippets.

@mundry
mundry / index.html
Created December 15, 2013 14:55
Google's snippet for lazy loading JavaScript.
<html>
<head>
</head>
<body>
<!-- Content -->
<a href="https://developers.google.com/speed/docs/best-practices/payload#DeferLoadingJS">Defer loading of JavaScript | Google Developers</a>
<script type="text/javascript">
// Add a script element as a child of the body.
@mundry
mundry / taglist.py
Last active December 31, 2015 11:08
List the tags used in a (set of) HTML file(s).
#!/usr/bin/env python2.7
from sys import argv
from bs4 import BeautifulSoup
from bs4.element import Tag
soup = None
tags = set()
@mundry
mundry / scss.sh
Created December 16, 2013 13:27
SCSS command
scss --unix-newlines --style <style> --precision 8 -E utf-8 [--no-cache] [--watch] input-file.scss:output-file.css
@mundry
mundry / README.markdown
Last active June 22, 2018 11:14
A simple script to automate the steps needed to update the current git installation to the latest version.

Update Git

A simple script to automate the steps needed to update the current git installation to the latest version.

Execution

@mundry
mundry / file_fingerprint.py
Last active January 23, 2019 21:37
Generate a file's fingerprint from its content.
#!/usr/bin/env python2.7
from os import rename
from hashlib import sha1
INPUT_PATH = 'data'
INPUT_FILES = ['all.min.css', 'all.css']
OUTPUT_PATH = 'output'
@mundry
mundry / jquery-1.10.2.min.js
Last active January 1, 2016 09:39
An overview of the classes added to the html tag by Modernizr.
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("o
@mundry
mundry / encode_email.py
Created January 5, 2014 12:28
A simple script to obscure an email address with HTML entities.
#!/usr/bin/env python2.7
from random import randint
addr = "[email protected]"
def ascii_to_html_entity(char):
@mundry
mundry / README.markdown
Last active August 29, 2015 13:56
How to install rvm, Ruby, Rails, passenger and nginx on a CentOS box.

Copy of [this][1] blog entry originally posted on January 7, 2011

Installing RVM + Ruby + Rails + Passenger + nginx on CentOS

# Create the rvm group and add any users who will be using rvm to the group
sudo su -
groupadd rvm

# Start by adding the root user (required to install RVM)

usermod -a -G rvm root

@mundry
mundry / README.markdown
Last active June 6, 2024 14:46
Instructions to build Chromium on a fresh install of Fedora 20.

Build Chromium on Fedora 20

Install Dependencies

sudo yum install GConf2-devel systemd-devel mesa-libGLU-devel libstdc++.i686 subversion \
libX11-devel libjpeg-devel gcc-c++ libXScrnSaver-devel fontconfig-devel cups-devel libgcc.i686 \
flex libXt-devel pulseaudio-libs-devel dbus-glib-devel bison dbus-devel alsa-lib-devel \
elfutils-libelf-devel libgnome-keyring-devel pango-devel glibc.i686 libXtst-devel pkgconfig \
libudev-devel glib2-devel bzip2-devel python nss-devel nspr-devel libcap-devel expat-devel \
gperf pciutils-devel gtk2-devel libgcrypt-devel perl freetype-devel perl-Digest-MD5 \
@mundry
mundry / diamond.py
Created March 22, 2014 18:19
Script to print a diamond to the console.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def print_diamond(size):
if size % 2 == 0:
raise Exception("Size has to be an odd number.")
return
for l in range(size):
spaces = abs(l - size / 2)
stars = size - spaces * 2