Skip to content

Instantly share code, notes, and snippets.

View mattdanielbrown's full-sized avatar

Matt Daniel Brown mattdanielbrown

View GitHub Profile
@zenorocha
zenorocha / multiple-3rd-party-widgets.js
Last active October 4, 2024 14:04
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@earthgecko
earthgecko / is_integer
Created February 10, 2013 17:45
is_integer
function is_integer () {
# exit code 0 - the string is an integer
# exit code 1 - the string is not an integer
local string=$1
[[ $string == ${string//[^0-9]/} ]]
}
@jonaslund
jonaslund / .zshrc
Created November 12, 2012 01:05
zsh config
# Path to your oh-my-zsh configuration.
ZSH=$HOME/v/oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="mgutz"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 19, 2025 05:13
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@antsa
antsa / placeholder.scss
Created March 23, 2012 12:00
Placeholder mixin for Sass
// Placeholder @mixin for Sass
//
// A mixin to style placeholders in HTML5 form elements.
// Includes also a .placeholder class to be used with a polyfill e.g.
// https://github.com/mathiasbynens/jquery-placeholder
// Requires Sass 3.2.
//
// Example usage (.scss):
//
// input {
@robnyman
robnyman / Create-open-IndexedDB-database.js
Created February 23, 2012 15:50
Create/open IndexedDB database
// IndexedDB
window.indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction,
dbVersion = 1;
/*
Note: The recommended way to do this is assigning it to window.indexedDB,
to avoid potential issues in the global scope when web browsers start
removing prefixes in their implementations.
@arielsalminen
arielsalminen / triggerpoints.css
Created May 15, 2011 12:54
Triggerpoints for kiskolabs.com
/* 970px and under */
@media screen and (max-width: 970px) { ... }
/* 840px and under */
@media screen and (max-width: 840px) { ... }
/* 740px and under */
@media screen and (max-width: 740px) { ... }
/* 600px and under */
@media screen and (max-width: 600px) { ... }
/* 480px and under */
@media screen and (max-width: 480px) { ... }
@itayd
itayd / gist
Created February 8, 2011 11:25
bash gist cli
#!/bin/bash
require() {
for what in $*; do
if !(which $what >& /dev/null); then
echo "error: $what is required to run this script, please install it"
exit 1
fi
done
}
@itayd
itayd / gistcat
Created December 12, 2010 14:26
cat a file from gist, search by username + filename
#!/bin/bash
notags() {
while read line; do
echo $line | sed -e "s/<[^>]*>/ /g" -e "s/ / /g"
done
}
user=$1
wanted=$2