This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Two methods to make a single function call | |
*/ | |
// Using a flag | |
var myFun = (function() { | |
var called = false; | |
return function() { | |
if (!called) { | |
console.log("I've been called"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Redirects. | |
http://codegarage.com/blog/2011/03/how-to-301-redirect-your-wordpress-blog-to-a-new-url/ | |
# Test 1 | |
RewriteEngine on | |
RewriteRule ^(.*)$ http://yourcodegarage.com/blog/$1 [R=301,L] | |
# Test 2 | |
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !^/$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Requests for Handlebars Templates with jquery ajax function | |
* | |
* Usage: | |
* var template = Handlebars.renderTemplate('templateName', templateData); | |
* | |
* Feel free to append template anywhere else after. | |
* | |
* @author : Zell Liew | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).scroll(function(event) { | |
var headerArea = $header.offset().top + $header.height(); | |
var windowTop = $(window).scrollTop(); | |
if (windowTop > headerArea) { | |
// do stuff | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var current = new Date(), | |
day = current.getDate(), | |
month = current.getMonth(), | |
year = current.getFullYear(); | |
/** | |
* Converting to and from milliseconds. | |
*/ | |
// Converting to: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin triangle($direction, $color, $size) { | |
@if $direction == "left" { | |
border-bottom: $size solid transparent; | |
border-right: $size solid $color; | |
border-top: $size solid transparent; | |
} | |
@else if $direction == "right" { | |
border-bottom: $size solid transparent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
-webkit-font-smoothing: antialiased; | |
font-smoothing: antialiased; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple debouncer. | |
// https://github.com/louisremi/jquery-smartresize | |
function on_resize(c, t) { | |
onresize = function() { | |
clearTimeout(t); | |
t = setTimeout(c, 100) | |
}; | |
return c | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Responsive image with padding bottom hack | |
.parent { | |
position: relative; | |
padding-bottom: 75%; /* 3:4 aspect ratio */ | |
} | |
.child { | |
position: absolute; | |
top: 0; | |
} |