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
deepfriedmind / showcolors.sh
Created Aug 3, 2015
Output text strings in all 8 base colors + their light/bold variant (tested in bash on OS X)
View showcolors.sh
#!/bin/bash
i=30
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 "
else
prefix=""
fi
@deepfriedmind
deepfriedmind / htpgen.sh
Created Aug 29, 2014
HTPGen – Quickly generate .htpasswd / .htaccess files for basic Apache authentication. To be able to run `htpgen.sh` from anywhere, place the file somewhere that's included in your `PATH`, e.g. `/usr/local/bin` or `/usr/bin`.
View htpgen.sh
#!/bin/bash
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
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
deepfriedmind / .gitignore
Last active May 28, 2019
Shell-scripts I run after a fresh install of OS X.
View .gitignore
###OSX###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
@deepfriedmind
deepfriedmind / YouTube-Fade-Pause.coffee
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.
View YouTube-Fade-Pause.coffee
###*
* 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 "'#{Object::toString.call player}' is not a valid YouTube player instance."
currentVolume = player.getVolume()
if currentVolume is 0
player.pauseVideo()
@deepfriedmind
deepfriedmind / Media-Query-Matcher.coffee
Last active Aug 29, 2015
Media Query Matcher. Match a specific breakpoint using Modernizr.mq() (example breakpoints are Bootstrap defaults) – Requires Modernizr, obviously.
View Media-Query-Matcher.coffee
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
deepfriedmind / BowerOpen.sh
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`
View BowerOpen.sh
boweropen() {
input=$(bower lookup "$@")
open $(echo $input | perl -pe 's/^.*(?=github\.com)/http:\/\//' | perl -pe 's/\.git//')
}
@deepfriedmind
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.