Skip to content

Instantly share code, notes, and snippets.

@geoffyuen
geoffyuen / _flatcolours.scss
Created December 14, 2013 06:19
Flat colours in plain english - easier to remember
$blue: #3498db;
$dkblue: #2980b9;
$green: #1bbc9b;
$dkgreen: #27ae60;
$bluegreen: #1abc9c;
$purple: #9b59b6;
$dkpurple: #8e44ad;
$greensea: #16a085;
$yellow: #f1c40f;
$dkyellow: #f39c12;
// find all elements with a z-index and indicate what they are.
// uses css outline which is not supported in IE <8
function contrast(color){ return '#' +
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff');
}
jQuery('*')
.filter(function(){ return $(this).css('zIndex') !== 'auto'; })
.each(function(){
@geoffyuen
geoffyuen / ios simulator directory
Created December 22, 2013 20:16
The is the folder path to the iOS Simulator in Xcode
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications
@geoffyuen
geoffyuen / csvtoarr
Created January 11, 2014 23:54
open a .csv and convert to associative array. header row is used as keys. (found on stackoverflow somewhere...)
<?
ini_set('auto_detect_line_endings',TRUE);
function getcsv($thecsv) {
if (($handle = fopen("{$thecsv}", 'r')) === false) {
die('Error opening file');
}
@geoffyuen
geoffyuen / nav highlighter
Created January 29, 2014 21:15
Adds .active class to an <a> if the url (page and extension only) == the a.href inside .site-menu class
$('.active').removeClass('active');
$('.site-menu a[href$="' + location.pathname.substring().split("/").pop() + '"]').addClass('active');
@geoffyuen
geoffyuen / boilerplate-additions
Last active August 29, 2015 14:02
Things to plugin into boilerplate
Put this before doctype for force IE to remove compatibility button (in addition to <meta http-equiv="X-UA-Compatible" content="IE=edge">):
<!--[if IE]><![endif]-->
Live reload script for localhost (handy when using iframes):
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@geoffyuen
geoffyuen / wpinstall.sh
Last active October 30, 2015 05:26
Download and install Wordpress from OSX terminal - WIP
wget http://wordpress.org/latest.tar.gz; tar -xvzf latest.tar.gz; mv wordpress/* .; rmdir wordpress/ ; rm latest.tar.gz; rm wp-content/plugins/hello.php; rm -rf wp-content/plugins/akismet; rm -rf wp-content/themes/twentyfourteen; rm -rf wp-content/themes/twentythirteen
#/Applications/MAMP/Library/bin/mysql -uroot -proot -e "create database [databasename];"
@geoffyuen
geoffyuen / getip.command
Created July 9, 2014 15:54
osx, get ip from terminal
ipconfig getifaddr en0
OUTPUT=$(ipconfig getifaddr en0); echo ${OUTPUT}
@geoffyuen
geoffyuen / wp-content
Created July 10, 2014 03:02
download the wp-content folder via ftp. (this will create the wp-folder in the current directory)
wget -m -nH ftp://user:pass@serverurl//wp-content
@geoffyuen
geoffyuen / nongreedy.txt
Created August 6, 2014 18:36
Regex Reminder: not so greedy selector
Instead of using .*
try .+?