Skip to content

Instantly share code, notes, and snippets.

@jonsuh
jonsuh / js-video-basic.css
Last active June 8, 2019 17:06
Responsive YouTube, Vimeo, Embed, and HTML5 Videos with CSS Usage
.js-video {
height: 0;
padding-top: 25px;
padding-bottom: 67.5%;
margin-bottom: 10px;
position: relative;
overflow: hidden;
}
.js-video.widescreen {
@jonsuh
jonsuh / js-ajax-php-json-return.html
Last active September 17, 2022 02:57
jQuery AJAX Call to PHP Script with JSON Return
<div class="the-return">
[HTML is replaced when successful.]
</div>
@jonsuh
jonsuh / killall-finder
Created November 19, 2012 16:35
Remove Duplicates from the Open With Menu in Finder on OS X
killall Finder
@jonsuh
jonsuh / js-ads.css
Created December 3, 2012 17:34
Responsive Google AdSense Ads
.js-gads {
overflow: hidden;
}
@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 / 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();
// 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 / 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
@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 / 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() {