Skip to content

Instantly share code, notes, and snippets.

View ixzy24's full-sized avatar
🏠
Working from home

Fahudh Haneef ixzy24

🏠
Working from home
View GitHub Profile
@ixzy24
ixzy24 / d3.min.js
Last active August 29, 2015 14:23 — forked from MrAlexLau/d3.min.js
!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function r(n){return null===n?0/0:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function c(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function l(){this._=Object.create(null)}function s(n){return(n+="")===pa||n[0]===va?va+n:n}function f(n){return(n+="")[0]===va?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[]
var animals = [
{ name: "Waffles", type: "dog", age: 12 },
{ name: "Fluffy", type: "cat", age: 14 },
{ name: "Spelunky", type: "dog", age: 4 },
{ name: "Hank", type: "dog", age: 11 }
];
// filter dogs
animals = animals.filter(function(animal) {
return animal.type === "dog";
@ixzy24
ixzy24 / gist:2878038
Created June 5, 2012 21:18
Extending jQuery selector
jQuery.expr[':'].regex = function(elem, index, match) {
var matchParams = match[3].split(','),
validLabels = /^(data|css):/,
attr = {
method: matchParams[0].match(validLabels) ?
matchParams[0].split(':')[0] : 'attr',
property: matchParams.shift().replace(validLabels,'')
},
regexFlags = 'ig',
regex = new RegExp(matchParams.join('').replace(/^s+|s+$/g,''), regexFlags);
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
body {
@ixzy24
ixzy24 / gist:2877608
Created June 5, 2012 20:30
html5 placeholder fallback
// jQuery code
var i = document.createElement("input");
// Only bind if placeholder isn't natively supported by the browser
if (!("placeholder" in i)) {
$("input[placeholder]").each(function () {
var self = $(this);
self.val(self.attr("placeholder")).bind({
focus: function () {
if (self.val() === self.attr("placeholder")) {
@ixzy24
ixzy24 / index.html
Created June 4, 2012 06:07
Basic HTML5 Skeleton
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Title</title>
@ixzy24
ixzy24 / gist:2866441
Created June 4, 2012 04:55
Targeted Css, Mozzila
@-moz-document url-prefix() {
.date {
padding: 16px 0 0 0;
}
.date p span {
padding: 9px 0 3px 0;
}
}
@ixzy24
ixzy24 / gist:2863518
Created June 3, 2012 13:32
email validation in PHP
<?php
function is_valid_email($email)
{
if(preg_match("/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/", $email) > 0)
return true;
else
return false;
}
@ixzy24
ixzy24 / detection.js
Created June 3, 2012 13:30
JavaScript browser detection
// Browser detection
// Internet Explorer
var ie = document.all != null; //ie4 and above
var ie5 = document.getElementById && document.all;
var ie6 = document.getElementById && document.all&&(navigator.appVersion.indexOf("MSIE 6.")>=0);
// Netscape
var ns4 = document.layers != null;
var ns6 = document.getElementById && !document.all;