Skip to content

Instantly share code, notes, and snippets.

View codyjlandstrom's full-sized avatar

Cody J Landstrom codyjlandstrom

View GitHub Profile
.logo {
background-image: url(logo.svg);
}
.no-svg .logo {
background-image: url(logo.png);
}

Setup New Mac From Scratch.

Updated 2014-06-03.

Install Xcode 5

The download/install takes a while so start it first. When it finishes downloading you will still need to run it to complete installation.

Note: Make sure you install the XCode Command Line Tools after XCode is done installing. To do this go to Xcodes -> Preferences -> Downloads -> Command Line Tools -> Install. If you don't you might not be able to install brew packages (i.e. brew install wget will fail).

@codyjlandstrom
codyjlandstrom / gist:2a6371c7dc9d549707a8
Last active August 29, 2015 14:01
SVG Image load fallback
<img src="failed-to-load.svg" onerror="this.onerror=null;this.src='logo.png';" />
@codyjlandstrom
codyjlandstrom / gist:10737845
Created April 15, 2014 14:38
Count number of times a character appears in a line. In this case "
awk -F\" '{print NF-1}' <fileName>
@codyjlandstrom
codyjlandstrom / gist:9924584
Created April 1, 2014 22:39
Find applications using a certain port
$ sudo lsof -i -n -P | grep 443
Explained: http://explainshell.com/explain?cmd=sudo+lsof+-i+-n+-P+%7C+grep+443
@codyjlandstrom
codyjlandstrom / gradient.css
Created March 19, 2014 16:01
Text section with color gradient
p {
background: -webkit-linear-gradient(top,#fd0b58 0,#a32b68 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
@codyjlandstrom
codyjlandstrom / referers
Created March 17, 2014 17:31
S3 Bucket Policy - Only allow HTTP requests from specific referers
{
"Version": "2012-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests referred by www.mysite.com and mysite.com",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::examplebucket/*",
@codyjlandstrom
codyjlandstrom / gist:9260479
Last active August 29, 2015 13:56
.htaccess X-UA-Compatible for attribute http-equiv on element meta
# Fix page validation by adding X-UA-Compatible here
<FilesMatch "\.(htm|html|php)$">
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</FilesMatch>
@codyjlandstrom
codyjlandstrom / gist:9211733
Last active August 29, 2015 13:56
Command Line base64 SVG - copy to clipboard
echo -n `cat logo.svg` | base64 | pbcopy
openssl base64 < path/to/file.png | tr -d '\n' | pbcopy
# Skip writing the file and just copy the base64
cat path/to/file.png | openssl base64 | tr -d '\n' | pbcopy
In Sublime Text w/ Emmet:
- place cursor in file url
- control + shift + d
@codyjlandstrom
codyjlandstrom / gist:9182590
Created February 24, 2014 05:49
Wordpress - enqueue jQuery from Google CDN
//jQuery Insert From Google
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}