This file contains 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="fb-container" style="width:100%;"> | |
<div class="fb-page" data-href="https://www.facebook.com/facebook" data-height="160" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"></div> | |
</div> |
This file contains 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 | |
function minify_css( $buffer ) { | |
if( trim( $buffer ) === "") return $buffer; | |
// Remove comments | |
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); | |
// Remove whitespace | |
$buffer = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $buffer); |
This file contains 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
/** | |
* @link https://davidwalsh.name/javascript-debounce-function | |
* | |
* Here's the basic JavaScript debounce function (as taken from Underscore.js): | |
*/ | |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. |
This file contains 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
function debounce(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}} |
This file contains 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
// Source: http://stackoverflow.com/questions/14866775/detect-document-height-change | |
var $j = jQuery.noConflict(); | |
$j( document ).ready(function($) { | |
function onElementHeightChange(elm, callback){ | |
var lastHeight = elm.clientHeight, newHeight; | |
(function run(){ | |
newHeight = elm.clientHeight; | |
if( lastHeight != newHeight ) | |
callback(); |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Scrolling URL Hash</title> | |
<meta name="description" content="Webpage for xxxx"> | |
<style> | |
body { | |
height: 2000px; | |
} |
This file contains 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
/* | |
* Source: http://stackoverflow.com/questions/20131168/jquery-javascript-hooks/20132960#20132960 | |
* Gist: https://gist.github.com/JoeSz/6aa061ff48eaf1af658d3adf9d71ec37 | |
* | |
* JavaScript Hooks | |
* Essentially it's a place in code that allows you to tap in to a module to either provide different | |
* behavior or to react when something happens. | |
* (http://stackoverflow.com/questions/467557/what-is-meant-by-the-term-hook-in-programming/467568#467568) | |
* | |
* or as Wikipedia says: |
This file contains 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
// Returns a function, that, when invoked, will only be triggered at most once | |
// during a given window of time. | |
// Source: https://gist.github.com/killersean/6742f98122d1207cf3bd | |
function throttle(callback, limit, callbackArgs) { | |
var wait = false; | |
return function() { | |
if (wait) { | |
return; | |
} | |
callback.call(callbackArgs); |
This file contains 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
/** | |
* timedInterval | |
* | |
* The method calls a function or evaluates an expression at specified intervals (in milliseconds) | |
* until a specified number of milliseconds. | |
* | |
* @param {Function} callback | |
* @param {int} interval - run every [interval] ms | |
* @param {int} expiration - run until [expiration] in ms | |
* @param {mixed} callbackArgs - arguments for callback function |
This file contains 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
/* Source: http://stackoverflow.com/questions/11173106/apply-style-only-on-ie/36448860#36448860 */ | |
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { | |
#myElement { | |
/* Enter your style code */ | |
} | |
} |
OlderNewer