Skip to content

Instantly share code, notes, and snippets.

View msrafi's full-sized avatar

Rafi msrafi

  • Jersey City
View GitHub Profile
@msrafi
msrafi / gulpfile.js
Last active August 29, 2015 14:21 — forked from bengolder/gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
concat = require('gulp-concat'),
less = require('gulp-less'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
cssmin = require('gulp-minify-css'),
htmlmin = require('gulp-minify-html'),
uglify = require('gulp-uglify'),
streamify = require('gulp-streamify'),
@msrafi
msrafi / gulpfile.js
Last active August 29, 2015 14:17 — forked from samuelhorn/gulpfile.js
/*******************************************************************************
1. DEPENDENCIES
*******************************************************************************/
var gulp = require('gulp'); // gulp core
sass = require('gulp-sass'), // sass compiler
uglify = require('gulp-uglify'), // uglifies the js
// jshint = require('gulp-jshint'), // check if js is ok
rename = require("gulp-rename"); // rename files
concat = require('gulp-concat'), // concatinate js
@msrafi
msrafi / jq_ajax_inside_loop.js
Created March 17, 2015 19:59
jQuery: Ajax in loop
// Extending jQuery.when
if (jQuery.when.all === undefined) {
jQuery.when.all = function(deferreds) {
var deferred = new jQuery.Deferred();
$.when.apply(jQuery, deferreds).then(
function() {
deferred.resolve(Array.prototype.slice.call(arguments));
},
function() {
@msrafi
msrafi / isVisible.js
Created March 8, 2015 00:20
Javascript: isVisible
function isVisible(el) {
// get offset
var y = getOffset(el, 'offsetTop');
// convert to screen coordinate
y = y - window.scrollY;
var height = el.clientHeight;
var windowHeight = window.innerHeight;
return (y + height > 0 && y < windowHeight);
@msrafi
msrafi / ie_detection.js
Created February 4, 2015 15:32
Javascript: IE Detection
var ie = (function (){
if (window.ActiveXObject === undefined) return null;
if (!window.XMLHttpRequest) return 6;
if (!document.querySelector) return 7;
if (!document.addEventListener) return 8;
if (!window.atob) return 9;
if (!document.__proto__) return 10;
return 11;
})();
@msrafi
msrafi / easing.js
Created December 10, 2014 23:22
Animation easing CSS as obj
easingTable = {
linear: "linear",
swing: "ease-out",
bounce: "cubic-bezier(0,.35,.5,1.3)",
// Penner equation approximations from Matthew Lein's Ceaser: http://matthewlein.com/ceaser/
easeInQuad: "cubic-bezier(.55,.085,.68,.53)",
easeInCubic: "cubic-bezier(.55,.055,.675,.19)",
easeInQuart: "cubic-bezier(.895,.03,.685,.22)",
easeInQuint: "cubic-bezier(.755,.05,.855,.06)",
easeInSine: "cubic-bezier(.47,0,.745,.715)",
@msrafi
msrafi / LICENSE.txt
Last active August 29, 2015 14:09 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@msrafi
msrafi / databind.html
Created August 21, 2014 21:19
bindings from 140byt.es
<!doctype html>
<html lang="en">
<head>
<title>data-binding test</title>
</head>
<body>
<fieldset><legend>Text Input</legend>
<div><label>Label: </label><span class="text"></span></div>
<div><input class="text"></div>