This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* parse given query string url, and return it as | |
* object literal with proper type casting for primitives | |
* | |
* @param {string} url | |
* @return {object} queryString | |
* | |
* notes: | |
* - requires jQuery for linear typecasting | |
* - parameter names are all lowercased |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* string parser with data passed as arguments | |
* | |
* @param {arguments} | |
* @return {string} | |
* | |
* example: | |
* -------- | |
* 'i used both [0] & [1], however [1] looks good so far'.parse( 'iphone', 'andoird' ); // "i used both iphone & andoird, however andoird looks good so far" | |
* 'the weather now in [0] seems to be [1]'.parse( 'Dubai', function() { return 'very hot'; }); // "the weather now in Dubai seems to be very hot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* simulating constant behaviour where | |
* given value cannot be changed | |
* | |
* @param {object} target object where the constant will be defined | |
* @param {string} key | |
* @param {object} value | |
* @return {object} constant | |
* | |
* example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This shell script is used to bootstrap the app and update external libraries | |
# | |
# ====== IMPORTANT ====== | |
# | |
# it may break application if 3rd party libs aren't backwards compatible | |
# or if libs were edited locally, use with care !!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global module:false*/ | |
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: '<json:package.json>', | |
meta: { | |
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# less to scss based on http://stackoverflow.com/a/19167099/2363935 | |
namespace :convert do | |
task :less_to_scss do | |
source_glob = "assets/less/*.less" | |
dest_dir = "converted" | |
rm_r dest_dir rescue nil | |
mkdir_p(dest_dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global module:false*/ | |
module.exports = function(grunt) { | |
// Load tasks | |
grunt.loadTasks('util/grunt'); | |
// Load vendors tasks | |
grunt.loadNpmTasks('grunt-contrib-compass'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------ | |
// generic media query mixin | |
// ------------------------------ | |
// author: Anas Nakawa | |
// license: MIT | |
// ------------------------------ | |
// table of content | |
// ------------------------------ | |
// media-compact-retina (private) | |
// media-conpact-normal (private) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tiny JavaScript inheritance | |
// extracted from CoffeeScript | |
// | |
// * **param:** {Class} child | |
// * **param:** {Class} parent | |
var extends = function( child, parent ) { | |
for ( var key in parent ) { | |
if ( {}.hasOwnProperty.call( parent, key ) ) { | |
child[ key ] = parent[ key ]; | |
} |
OlderNewer