Skip to content

Instantly share code, notes, and snippets.

View anasnakawa's full-sized avatar
💭
I may be slow to respond.

Anas Nakawa anasnakawa

💭
I may be slow to respond.
View GitHub Profile
@anasnakawa
anasnakawa / inline-image.scss
Created October 16, 2012 17:15
Base64 inline images function using compass/sass
.some-selector {
background: white #{inline_image("image.png")}
}
@anasnakawa
anasnakawa / jQuery-multi-open-accordion.html
Created November 17, 2012 05:15
markup for an old plugin
<div id="multiAccordion">
<h3><a href="#">tab 1</a></h3>
<div>
Lorem ipsum dolor sit amet
</div>
<h3><a href="#">tab 2</a></h3>
<div>
Lorem ipsum dolor sit amet
</div>
<h3><a href="#">tab 3</a></h3>
$(function(){
$('#multiAccordion').multiAccordion();
});
@anasnakawa
anasnakawa / jQuery-multi-open-accordion.js
Created November 17, 2012 05:18
plugin initialization options
$(function(){
// this will make the second tab by default opened (index starts from 0)
$('#multiAccordion').multiAccordion({active: 1 });
// [ OR ]
// supports multiple tabs to be opened by default
$('#multiAccordion').multiAccordion({active: [1, 2, 3] });
// show all tabs
/* fired when any tab is clicked, ui here hold clicked tab and its content
* ui['tab'] // current tab
* ui['content'] // current tab content (div)
*/
click: function(event, ui) {}
// when accordion is initialized, ui here holds a jQuery object to the whole accordion
init: function(event, ui) {}
// when tab is shown, ui here hold the same as in click event above
// destroying the plugin and removing all handlers, and styles
$('#multiAccordion').multiAccordion('destroy');
// get an array of active tabs, if no active tabs it will return a one element array with [-1] value
$('#multiAccordion').multiAccordion('getActiveTabs');
// you can use the previous method to get active tabs value, then you can set it later simply by
// retrieve
var activeTabs = $('#multiAccordion').multiAccordion('getActiveTabs');
// set
@anasnakawa
anasnakawa / tiny-template.js
Last active October 13, 2015 07:18
parse a given template and repalce any variables wrapped withing brackets
// parse a given template and repalce any variables wrapped with brackets '{' & '}' with the
// corresponding object found in the passed context param
// * **param:** {string} template sting template to be parsed
// * **param:** {object} context object containing variables to inject into the template
//
// e.g: parse( 'hello my name is {name}, I am a {title}', {
// name: 'Anas Nakawa'
// title: function() {
// return 'software developer'
// }
@anasnakawa
anasnakawa / javascript-comments.js
Created November 30, 2012 12:47
javascript file comments structure
/*!
* ------------------------------
* library name v#.#.#
* http://library-url.com
* license: MIT license (http://opensource.org/licenses/MIT)
* ------------------------------
*/
// ------------------------------
// table of content
@anasnakawa
anasnakawa / jquery.ajax.fake.md
Last active December 10, 2015 03:28
fake ajax readme file

jQuery.ajax.fake

when you want to fake an ajax call, that's because your server's web service is just not ready yet, and whenever that web service is ready, switching back to it should cost nothing..

with jquery.ajax.fake you simply write pure jQuery ajax call, with only one extra property fake: true

How to use it

include jquery.ajax.fake.js script into your markup, and create webservices.fake.js to handle fake ajax calls

<script src="jquery.ajax.fake.js"></script>

Paid Parkings in Dubai Internet City

in Dubai Internet City, specifically behind building 15, 16 & 17, there are over than 200 covered car parkings, dedicated for the people who work in those buildings, in usual business days, these parkings remain occupied for the whole normal business working hours (normally from 9:00am - 6:00pm)..

starting from 15th January 2013, RTA has applied a fees on these parkings which inforced most of us to go park in a very far places to avoid any fees/fines, not to mention about people who arrive late to work, will find it almost impossible to park anywhere else those paid parking..


The End Result

RTA might generate some revenue from those fees, but most of us won't use it,

we used to see RTA making our life better, but in this particular area I simply don't see that..