Skip to content

Instantly share code, notes, and snippets.

@rhysburnie
rhysburnie / myns.makeShapeComposite.js
Last active December 16, 2015 01:19
makeShapeComposite function for Kineticjs
/**
* makeShapeComposite function on a gloabl namespace - see var namespace
*
* ns.kineticSupport.makeShapeComposite(shape, operation);
* @param Kinetic.Shape (family)
* @param Sting - valid globalCompositeOperation name
* @return the supplied shape after globalCompositeOperation set
*/
(function(){
var namespace = 'myns',
@rhysburnie
rhysburnie / clearfix-micro.css
Last active December 16, 2015 01:19
ng style micro clearfix
/* http://nicolasgallagher.com/micro-clearfix-hack/ */
.cf:before,
.cf:after {
content: " ";
display: table;
}
.cf:after {
clear: both;
}
@rhysburnie
rhysburnie / jquery-ajax-dataFilter.js
Last active January 17, 2022 22:02
jQuery ajax dataFilter to remove scripts from html string to prevent script execution if loading string into a temp dom element
function dfStripScripts = function(data, type)
{
// incase the response is full html with scripts remove them
type = type || 'text';
if(type=='html'||type=='text'){
/*return data.replace(/<script.*>.*?<\/script>/gi, '');*/
return data.replace(/<script.*?>([\w\W\d\D\s\S\0\n\f\r\t\v\b\B]*?)<\/script>/gi, '');
}
return data;
};
@rhysburnie
rhysburnie / jquery.imgload.js
Last active December 16, 2015 06:59
onload image event plugin
/*!
* @author: Rhys Burnie [rb]
*
* MIT license
*/
;(function($){
$.fn.extend({
/**
* .imgload
@rhysburnie
rhysburnie / index.html
Created June 6, 2013 11:24
A CodePen by [rb]. angle swipe test 2 - test for a client project - requires full screen stretchy image with angle swipe ability. turns out dam easy with Raphael.
<div id="stage">
<div id="container"></div>
<a href="#">toggle animate</a>
</div>
@rhysburnie
rhysburnie / index.html
Created June 6, 2013 11:25
A CodePen by [rb]. angle swipe tests - Working out best way to make a swipe mask for angled divided screen the other requirement is that it maintains a perfect scaled stretch of window size
<div id="container"></div>
<code id="note">NB: this is just testing out shit not a demo of something - cheers</code>
@mixin instrinsic-ratio($width, $height, $position: relative)
{
@if unit($width) != unit($height) {
@warn "@include instrinsic-ratio-wrapper: $width and $height must share the same unit type, supplied was: #{$width} / #{$height}";
}
$w: to-unitless($width);
$h: to-unitless($height);
$ratio: $h / $w;
$percent: $ratio * 100%;
@rhysburnie
rhysburnie / jquery.externallinks.js
Last active August 29, 2015 13:59
Return filtered collection of external links
@rhysburnie
rhysburnie / rAF.js
Last active August 29, 2015 14:01 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Moller. fixes from Paul Irish and Tino Zijdel
// sorry Erik the umlaut in your name was causing errors in most compilers so replaced it with "o"
// MIT license
(function() {
var lastTime = 0;
(function() {
var lastScrollY = 0;
var ticking = false;
var update = function() {
// do your stuff
ticking = false;
};
var requestTick = function() {