This file contains hidden or 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
/** @constructor */ | |
window.alertbox = new (function($, window, undefined) { | |
var $alb = $('<div id="alertbox" class="alert">').hide().appendTo('body') | |
, timer = null | |
, next = []; | |
/** | |
* Enum for alert types and their respective class names | |
* | |
* @public |
This file contains hidden or 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/bash | |
STORAGE=/home/$USER/Downloads; | |
# Get Process ID | |
PROCID=$(pgrep -f flash); | |
# Change current directory to | |
cd /proc/$PROCID/fd; | |
# Get file names |
This file contains hidden or 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
function loadStack(stack, cb) { | |
if($.isArray(stack)) { | |
if(stack.length === 0) return cb(); | |
// TODO: implement the getScript method to make it standalone | |
$.getScript(stack.shift() + '.js', loadStack.bind(this, stack, cb)); | |
} | |
} |
This file contains hidden or 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
/* | |
* A simple JavaScript Template Engine | |
* | |
* By default replaces every {{ foo.bar }} with the | |
* the respective value from provided data object. | |
*/ | |
/* | |
* Return the value addressed in args from obj | |
* |
This file contains hidden or 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
/* | |
* Addressing the issue provided in the following Stackoverflow question: | |
* Check if class exists somewhere in parent - vanilla JS | |
* http://stackoverflow.com/q/16863917/717221 | |
*/ | |
function hasParent(element, parentSelector) { | |
var potentialParents = document.querySelectorAll(parentSelector); | |
for(i in potentialParents) if(potentialParents[i].contains(element)) | |
return potentialParents[i]; | |
return false; |
This file contains hidden or 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
define(['ng', 'moment-jalaali'], | |
function(ng, moment) { | |
var mod = ng.module('app.service.datetime', []); | |
mod.run(['$rootScope', function($rootScope) { | |
$rootScope.$on('$languageChangeSuccess', function(evt, newLang) { | |
if(newLang === 'fa') moment.loadPersian(); | |
else moment.locale('en'); | |
}); | |
}]); |
This file contains hidden or 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
// Retrieve a deep item from obj, recursively | |
function getDeep (obj, addr) { | |
if(typeof obj !== 'object' && !Array.isArray(obj)) | |
throw new TypeError("The Object argument must be an Object or an Array"); | |
if(typeof addr !== 'string' && !Array.isArray(addr)) | |
throw new TypeError("The Address argument must be a string or and array"); | |
// Split the dotted address into an array | |
if(typeof addr === 'string') { | |
addr = addr.split('.'); |
This file contains hidden or 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
package dominantcolor | |
// Optionally use this importable repository instead: | |
// https://github.com/Fardinak/dominantcolor | |
import ( | |
"github.com/nfnt/resize" | |
"image" | |
"image/color" | |
"image/color/palette" |
This file contains hidden or 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/bash | |
# This simple script mounts a PostgreSQL data directory as | |
# the lower dir, and a temp directory as the upper dir of | |
# a union mount; then bind mounts the volume into a docker | |
# container, running a new instance of PostgreSQL/PostGIS. | |
# | |
# This enables the user to run tests and migrations on | |
# production data, without worrying about data integrity or | |
# using too much storage for a full clone. |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Inspiration and sonarlint function from: https://github.com/janosgyerik/sonarlint-git-hooks | |
# ENVs | |
# $SKIPBRANCHTEST optional boolean | |
# $SKIPDIFFCHECK optional boolean | |
# $SKIPSONARLINT optional boolean | |
# use `-n` or `--no-verify` to bypass pre-commit and commit-msg hooks |
OlderNewer