Skip to content

Instantly share code, notes, and snippets.

View Demwunz's full-sized avatar
:octocat:
donuts

Fazal Demwunz

:octocat:
donuts
View GitHub Profile
@Demwunz
Demwunz / gist:813895
Created February 7, 2011 01:28
XSLT HTML5 Boilerplate starter
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:func="http://exslt.org/functions"
xmlns:head="http://headjs.com"
extension-element-prefixes="exsl func head">
<xsl:import href="../utilities/page-title.xsl"/>
<xsl:import href="../utilities/navigation.xsl"/>
@Demwunz
Demwunz / template_switcher.php
Last active October 1, 2015 07:48
Static Template browser
<?php
$directory = '';
$pages = glob($directory . "*.php");
foreach($pages as $page){
$thelist .= '<option value="'.$page.'">'.$page.'</option>';
}
?>
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
@Demwunz
Demwunz / _base.scss
Created March 9, 2012 15:35
SASS: susy/html5-boilerplate starter
// This file must be imported before loading html5-boilerplate
// Imports -------------------------------------------------------------------
@import "compass/css3";
@import "compass/typography/vertical_rhythm";
// Grid (http://susy.oddbird.net/) -----------------------------------------------------
//
@import "susy";
@Demwunz
Demwunz / ie6png.js
Created March 9, 2012 16:48
JavaScript: lightweight IE6 png fix
/*@cc_on
@if (@_win32)
try {document.execCommand('BackgroundImageCache', false, true);}catch(e){}
@end
@if (@_jscript_version <= 5.6)
(function pngFix (gif, arr) {
var k = arr.length, el, es;
while (k--) {
if (el=document.getElementById(arr[k])) {
es=el.style;es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', src='"+el.src+"',sizingMethod='image')";el.src=gif;
@Demwunz
Demwunz / jquery.slideshow.js
Created March 9, 2012 16:50
JavaScript: lightweight jQuery slideshow
var slideContainer = $('.carousel'),
slides = slideContainer.find('li'),
slideCount = slides.length,
oldSlide = 0,
currentSlide = 0,
fadeSpeed = 500,
slideSpeed = 4000,
auto = true,
animating = false,
tabs = $('.tabs, .carousel-links').find('li'),
@Demwunz
Demwunz / modernizr_jquery_placeholder_fix.js
Created March 14, 2012 16:27
JavaScript: Modernizr & jQuery placeholder replacement
if(!Modernizr.input.placeholder){
$('input[type=text]').each(function(i, elem) {
var input = $(elem),
placeholder = input.attr('placeholder');
if (this.defaultValue === '') {
this.defaultValue = placeholder;
}
input.on('focus', function () {
this.value == this.defaultValue ? this.value = '' : null;
})
@Demwunz
Demwunz / trim_text.jquery.js
Created March 15, 2012 16:39
JavaScript: trim text
trimText : function(obj, body, length){
var splitLocation = body.indexOf(' ', length);
if(splitLocation != -1) {
// truncate tip
var splitLocation = body.indexOf(' ', length),
str1 = body.substring(0, splitLocation),
str2 = body.substring(splitLocation, length - 1);
obj.html(str1 + '<span class="truncate_ellipsis">&hellip;</span>' + '<span class="truncate_more">' + str2 + '</span>');
obj.find('.truncate_more').css("display", "none");
}
@Demwunz
Demwunz / jquery.inview-pseudo.js
Created March 30, 2012 14:21
jQuery : inview psuedo-selector
//this is straight from http://forrst.com/posts/jQuery_inview_selector-V2Q
$.extend($.expr[':'], {
inview: function(el) {
var e = $(el),
w = $(window),
wt = w.scrollTop(),
wb = wt + w.height(),
et = e.offset().top,
eb = et + e.height();
@Demwunz
Demwunz / deviceorientation.js
Last active October 5, 2015 06:18
Check if Media Query has fired, device orientation and device type (via categorizr classes)
DASEFX ={
common:{
init: function(){
//using http://benalman.com/code/projects/jquery-throttle-debounce/docs/files/jquery-ba-throttle-debounce-js.html
$(window).resize( $.throttle( 250, true, function(e){
log('resized');
DASEFX.common.MediaQueryCheck();
}));
},
@Demwunz
Demwunz / agegate.ender.js
Created June 12, 2012 16:34
Ender Age Gate
SITE = {
common: {
init: function(){
SITE.functions.addOptions();
}
},
functions : {
ageGate : function(){
var min_age = 18;
//