Skip to content

Instantly share code, notes, and snippets.

View HichemBenChaaben's full-sized avatar
🚀
RW Code™️

Hichem ben chaabene HichemBenChaaben

🚀
RW Code™️
  • Amsterdam
  • 17:19 (UTC -12:00)
View GitHub Profile
@HichemBenChaaben
HichemBenChaaben / Default File
Created September 9, 2012 13:59
display modal box with loader
// plugin by hichem benchaabene
// load an external file while hovering an element
// load a specific div while hovering an element
(function($) {
$.fn.jsTip = function(options) {
var defaults={
boxName:'#box',
loader:'#loader',
boxContentName:'#boxContent',
opacity:.2,
@HichemBenChaaben
HichemBenChaaben / gist:5905171
Last active December 19, 2015 05:38
Blood and sweat
;(function ($, window, document, undefined) {
'use strict';
/*
ImageBreakpoint by dubizzle
A Responsive design candy that allow you to load only
the images you need depending on one of these breakpoints mobile/tablet/desktop
we will show mobile dedicated image for the non-js fallback
for ie8 :(Media queries won't really work unless you simulate them using respond.js)
HTML:
# src: http://www.craig-russell.co.uk/bulk-minify-shell-script/
CSS='css'
JS='js'
FILELIST="minify.$$.tmp"
COMPORESSOR="yuicompressor-2.4.2.jar"
MINCSS="css/styles.min.css"
# Minify CSS to single file
echo -n '' > $MINCSS
#!/bin/bash
#bash script for initiate grunt project
echo "We can't made node.js part of this installation"
echo "You need to install node js"
echo "
git clone git://github.com/ry/node.git
cd node
./configure
make
@HichemBenChaaben
HichemBenChaaben / manage.py
Created August 30, 2013 22:01
Simple python server
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
@HichemBenChaaben
HichemBenChaaben / cacheApp
Created September 9, 2013 19:20
Caching layer for Jquery
/*
*
** Tiny lib to make jQuery times faster
** Usage
** app = new
** app.$('#selector');
* var app = window._APP = new window.app({
* // Caching global window and document objects inside the app object
* "window": window,
* "document": document,
@HichemBenChaaben
HichemBenChaaben / cacheApp.js
Last active December 22, 2015 16:38
Caching layer for Jquery
/*
*
** Tiny lib to make jQuery times faster
** Usage ::::
* var app = window._APP = new window.app({
* // Caching global window and document objects inside the app object
* "window": window,
* "document": document,
* // jQuery
* "lib": $,
@HichemBenChaaben
HichemBenChaaben / experiment.js
Last active December 23, 2015 04:09
Ab test
/*! dubizzle Fuego build - v1.0.0 - created on 2013-09-16 */
$(function(){function displaysublistIndex(selector,number){$("#paa-subsections").find("ul").hide().eq(number).show(),0===number?filterItems():1===number?filterJobs():2===number?filterCars():$("#paa-subsections").css({"overflow-y":"hidden"}),2>=number&&$("#paa-subsections").css({"overflow-y":"scroll"})}function filterItems(){$("#items-for-sale_search").keyup(function(){var search_val=$(this).val();$("#items-for-sale-type").find("li").each(function(){-1===$(this).find("a").data("lang").toLowerCase().indexOf(search_val.toLowerCase())&&-1===$(this).text().toLowerCase().indexOf(search_val.toLowerCase())?$(this).hide():$(this).show()})})}function filterJobs(){$("#jobs_search").keyup(function(){var search_val=$(this).val();$("#jobs-type").find("li").each(function(){-1===$(this).find("a").data("lang").toLowerCase().indexOf(search_val.toLowerCase())&&-1===$(this).text().toLowerCase().indexOf(search_val.toLowerCase())?$(this).hide():$(this).show()})})}functio
@HichemBenChaaben
HichemBenChaaben / init.js
Created September 17, 2013 19:10
Init file
(function (window, document, $, undefined) {
"use strict";
/*
Strict mode helps in a couple ways:
- It catches some common coding bloopers by throwing exceptions.
- It prevents or throws errors when relatively "unsafe" actions are taken
(such as gaining access to the global object).
- It disables features that are confusing or poorly thought out.
Further reading: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
@HichemBenChaaben
HichemBenChaaben / gruntfile.js
Last active December 24, 2015 04:29
Gruntfile
module.exports = function(grunt) {
// NB : EXPANSION MODE MEANS YOU ARE ABLE OR NOT TO
// MODIFY THE FILES IN PLACE
// If you stop grunt in a middle of a process of image minification:
// Your images will break and that's because
// grunt is processing them in place and not creating a minified
// version of them, if that happen to you then git checkout the image folder
// and run grunt again !
// PROJECT PATHS CONFIGURATION