This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<audio controls autoplay muted volume="0.5"> | |
<source src="audio_file.ogg" type="audio/ogg"> | |
<source src="audio_file.mp3" type="audio/mpeg"> | |
</audio> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import sys | |
import re | |
# define method that can censor a string | |
def censor(the_input, blacklist, replacements): | |
# create a receptacle for the censored output | |
censored = [] | |
# split input into words, using the regex split method to preverve formatting | |
words = re.split(r'(\s+)', the_input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- make elemment really annoying to copy paste --> | |
<div class="unselectable" unselectable="on" onmousedown="return false;" onclick="return false;" ondragstart="return false;" onselectstart="return false;" style="-moz-user-select: none; cursor: default;"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extract html comments from files in current working directory recursively | |
from bs4 import BeautifulSoup, Comment | |
import os | |
# run the following commands to install dependencies (OS X): | |
# easy_install beautifulsoup4 | |
# easy_install lxml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map keyboard codes to their actual key value | |
var keyCodeMap = { | |
48: "0", | |
49: "1", | |
50: "2", | |
51: "3", | |
52: "4", | |
53: "5", | |
54: "6", | |
55: "7", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# log output of a command to a file while still viewing it in the shell | |
command | tee /dev/tty | >> file.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var detectDevices = { | |
iOS: function() { | |
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; | |
}, | |
Safari: function() { | |
return !!navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i) && typeof document.body.style.webkitFilter !== "undefined" && !window.chrome; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# prepend creation date to file names in format `YYY-MM-DD original_file_name` | |
for file in *; do | |
thedate=$(date -r $(stat -f %B "$file") +%Y-%m-%d) | |
echo "renaming \"$file\" to \"$thedate $file\"" | |
mv -v "$file" "$thedate $file" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Title of your document</title> | |
<meta charset="utf-8"> | |
<meta name="description" content="description of your document"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Format Current Date | |
date +%Y-%m-%d\ %H:%M:%S | |
# Reformatting string date | |
# most distros | |
date -d'27 JUN 2011' +%Y%m%d | |
# => 20110627 | |
# os x / BSD | |
date -jf "%m %d %Y" "07 08 1990" +%Y-%m-%d | |
# => 1990-07-08 |