Skip to content

Instantly share code, notes, and snippets.

@jonsuh
jonsuh / bash_profile
Last active August 29, 2015 14:23
~/.bash_profile
# Open applications
alias opentest='open "/Applications/Adium.app" && open "/Applications/Adobe Photoshop CC 2015/Adobe Photoshop CC 2015.app"'
# Close applications
alias closetest='osascript -e "quit app \"Adium\"" && osascript -e "quit app \"Adobe Photoshop CC 2015\""'
gulp.task('sass', function() {
return gulp.src('assets/sass/**/*.scss')
.pipe(plumber(plumberOptions))
.pipe(sass(sassOptions))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(gulp.dest('assets/css'))
.pipe(filter(sassFilterOptions))
.pipe(reload(sassReloadOptions));
});
@jonsuh
jonsuh / url_encode.rb
Created February 1, 2015 17:28
Jekyll URL Encode
# _plugins/url_encode.rb
require 'liquid'
require 'uri'
# Percent encoding for URI conforming to RFC 3986.
# Ref: http://tools.ietf.org/html/rfc3986#page-12
module URLEncode
def url_encode(url)
return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
@jonsuh
jonsuh / jquery.js
Last active August 29, 2015 14:03
Retina image replacement
var $images = $("img[data-1x]");
if (window.devicePixelRatio == 2) {
$.each($images, function() {
var $this = $(this);
$this.attr("src", $this.data("2x"));
});
} else {
$.each($images, function() {
@jonsuh
jonsuh / gist:9981407
Last active August 29, 2015 13:58
Chris Coyier RSS Email with Simple HTML DOM example
require_once('Simple_HTML_DOM.php');
$post_html = "<p>Some random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
<img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' alt='' />
</figure>
<p>Another random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
<img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' width='500' height='200' alt='' />
@jonsuh
jonsuh / bash
Last active December 19, 2015 11:59
Bash script for "w project.com"
function w(){
if [ -e ~/projects/$1 ]
then
cd ~/projects/$1
if [ "$1" != "" ]
then
echo -e "Switched to $1."
else
echo -e "Switched to project directory."
fi
// Global Foundation Settings
@import "core/settings";
// Comment out this import if you are customizing you imports below
// @import "foundation";
// Import specific parts of Foundation by commenting the import "foundation"
// and uncommenting what you want below. You must uncomment the following if customizing
@import "foundation/components/global"; // *always required
@jonsuh
jonsuh / abstract-better-scroll-to.js
Last active December 16, 2015 16:19
Better Scroll-To Anchor Links
$(document).ready(function(){
$(".anchorLink").click(function(e) {
e.preventDefault();
anchorScroll( $(this), $($(this).attr("href")), 100 );
});
});
function anchorScroll(this_obj, that_obj, base_speed) {
var this_offset = this_obj.offset();
@jonsuh
jonsuh / php53-mcrypt
Created April 1, 2013 15:33
php53-mcrypt Failed to build on 10.8.3
This file has been truncated, but you can view the full file.
jsuh:/etc$ HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install php53-mcrypt
==> Installing php53-mcrypt dependency: php53
==> Downloading http://www.php.net/get/php-5.3.22.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php53-5.3.22
tar xf /Library/Caches/Homebrew/php53-5.3.22
==> Downloading patches
/usr/bin/curl -f#LA Homebrew 0.9.4 (Ruby 1.8.7-358; Mac OS X 10.8.3) https://raw.github.com/gist/4222668/923819a243f3b6fefb79471671dbc8baff6e72b7/Makefile.global.diff -o 000-homebrew.diff
######################################################################## 100.0%
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
@jonsuh
jonsuh / js-ads.css
Created December 3, 2012 17:34
Responsive Google AdSense Ads
.js-gads {
overflow: hidden;
}