Skip to content

Instantly share code, notes, and snippets.

Andreas Wahlqvist deepfriedmind

Block or report user

Report or block deepfriedmind

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
deepfriedmind /
Created Aug 3, 2015
Output text strings in all 8 base colors + their light/bold variant (tested in bash on OS X)
for color in "black" "red" "green" "yellow" "blue" "purple" "cyan" "white" ; do
for attr in 0 1; do
if [[ $attr == 1 ]]; then
prefix="bold/light "
deepfriedmind /
Created Aug 29, 2014
HTPGen – Quickly generate .htpasswd / .htaccess files for basic Apache authentication. To be able to run `` from anywhere, place the file somewhere that's included in your `PATH`, e.g. `/usr/local/bin` or `/usr/bin`.
read -p "Enter username: " -r ht_username
read -p "Enter password: " -sr ht_password
echo -en "\n"
read -p "Enter full path to where .htpasswd will be placed on the web server: " -r ht_path
htpasswd -nb $ht_username $ht_password > .htpasswd
echo "AuthType Basic
deepfriedmind / debug.css
Created Aug 25, 2014
Add different colored backgrounds to all elements for debug purposes.
View debug.css
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
deepfriedmind / .gitignore
Last active May 28, 2019
Shell-scripts I run after a fresh install of OS X.
View .gitignore
# Icon must end with two \r
deepfriedmind /
Created Jul 11, 2014
YouTube iframe API : Fade/Pause – Gradually fade out the volume of a player, then pause it. After pausing, the volume is set back to 100% so it's not muted if resumed.
* Pause a YouTube video (after fading out sound).
* @param {object} player An `YT.Player` instance
pauseVideo = (player = undefined) ->
if not player then throw new Error 'No YouTube player instance specified.'
if not player.hasOwnProperty 'getVolume' then throw new Error "'#{ player}' is not a valid YouTube player instance."
currentVolume = player.getVolume()
if currentVolume is 0
deepfriedmind /
Last active Aug 29, 2015
Media Query Matcher. Match a specific breakpoint using (example breakpoints are Bootstrap defaults) – Requires Modernizr, obviously.
class MediaQueries
breakpoints =
screenXS: '(min-width: 480px)'
screenXSmax: '(max-width: 767px)'
screenSM: '(min-width: 768px)'
screenMD: '(min-width: 992px)'
screenLG: '(min-width: 1200px)'
errorMsg = 'Invalid or no breakpoint specified.'
if Object.keys? then errorMsg += " Valid arguments: #{Object.keys(breakpoints)}"
deepfriedmind /
Created Jun 25, 2014
Bash function to open the GitHub URL of a Bower package in the browser on Mac OS X. Add to .bashrc or .bash_profile. Usage: `boweropen bootstrap`
boweropen() {
input=$(bower lookup "$@")
open $(echo $input | perl -pe 's/^.*(?=github\.com)/http:\/\//' | perl -pe 's/\.git//')
deepfriedmind / toggleTouchScroll.js
Created Oct 1, 2013
A simple JavaScript function I wrote to toggle between enabling/disabling scrolling on mobile touch devices.
View toggleTouchScroll.js
var toggleTouchScroll = function() {
var d = document;
if (typeof d.ontouchmove === 'object') return d.ontouchmove = function() {
return false;
if (typeof d.ontouchmove === 'function') return d.ontouchmove() ? d.ontouchmove = function() {
return false;
} : d.ontouchmove = function() {
return true;
You can’t perform that action at this time.