Skip to content

Instantly share code, notes, and snippets.

@cole007
cole007 / gist:54874745ec4178ca64c6
Created November 24, 2014 13:43
Capitalism quote, Che Guevara
"In capitalist system people live in an invisible cage, for example, they accept the myth of the self-made man, but they do not understand that opportunities for majority are determined by the forces completely beyond individual control"
From Che, Part One
http://www.imdb.com/title/tt0892255/
@cole007
cole007 / BEM rhyme
Created December 2, 2014 12:37
BEM rhyme for @kaelifa :D
Block is a house that is nice and square,
Element is a room with its walls all bare,
Modifier is the wallpaper, hang with care!
.house
.house__room
.house__room—-paisley
@cole007
cole007 / PHP.md
Last active August 29, 2015 14:10
PHP role @asclearasmud, Bath

No recruitment agencies please. Yes, we know you’re different to all those other agencies that call unsolicited. It’s not you. It’s us. Sorry


Mid-level PHP developer (£30-40k)

We are looking for a PHP developer to assist with the delivery of content-managed and bespoke websites at our offices in the centre of Bath.

You are happiest in code, executing front-end templates and design ideas in PHP and working in a modular, methodical fashion.

<!-- from page being fetched -->
<div class="page-content">
<h1>here is some content on the case-study page</h1>
</div>
@cole007
cole007 / index.html
Created January 7, 2015 09:31
Simple lazy load technique
<!-- place this at bottom the of your HTML page. it has to be after your images appear in the DOM -->
<script>
var imgs = document.getElementsByTagName('img');
// var i = 1 skips first instance. use 0 to do all images
for (var i = 1; i < imgs.length; i++) {
var src = imgs[i].src;
imgs[i].setAttribute('data-src',src);
// whatever, placeholder image
imgs[i].src="hello.jpg";
}
@cole007
cole007 / modernizr.js
Created January 12, 2015 14:59
Modernizr, touch events
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-touch-cssclasses-teststyles-prefixes
*/
;window.Modernizr=function(a,b,c){function w(a){j.cssText=a}function x(a,b){return w(m.join(a+";")+(b||""))}function y(a,b){return typeof a===b}function z(a,b){return!!~(""+a).indexOf(b)}function A(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:y(f,"function")?f.bind(d||b):f}return!1}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l
@cole007
cole007 / msieversion.js
Created January 16, 2015 16:48
msieversion
function msieversion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
alert(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))));
else // If another browser, return 0
alert('otherbrowser');
@cole007
cole007 / context.md
Last active August 29, 2015 14:15
MA Web Thesis project - Cultural Context crit

Cultural Context Discussion/Report

"An exploration of the wider context within which your project is set. For example, if your project was to do with blogging, you could explore the history of the blog, the different forms it takes, self-publishing, self-expression, the democratisation of opinion and what effect this has had on culture and on society more broadly."

The next session will set out to explore the cultural context of your project.

  • What is the historic context of the subject matter?
  • How have similar things been achieved/tackled before?
  • How do current technologies and trends reflect changes in modern society?
  • How does the project relate to the needs of its target audience and how have those needs changed over time?
@cole007
cole007 / index.html
Last active August 29, 2015 14:15
wBmLJE
<section id="demos">
<div class="row">
<div id="owl2row-plugin" class="owl-carousel do-cycle" data-child="> div" data-visible="{0:2,600:3,1000:5}" data-cols="{0:2,600:3,1000:5}" data-rows="{0:1,600:3,1000:2}">
<div class="item">
<h4>1</h4>
</div>
<div class="item">
<h4>2</h4>
</div>
<div class="item">
@cole007
cole007 / scroll.js
Created February 27, 2015 14:42
Opacity scroll effect
// http://stackoverflow.com/a/8702428
var fadeStart=100, // 100px scroll or less will equiv to 1 opacity
fadeUntil=800, // 200px scroll or more will equiv to 0 opacity
fading = $('.slider-inner-container-fader');
$(window).bind('scroll', function(){
var offset = $(document).scrollTop(),
opacity=0;
if( offset<=fadeStart ){