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.prototype.fuzzy = function (s) { | |
var hay = this.toLowerCase(), i = 0, n = 0, l; | |
s = s.toLowerCase(); | |
for (; l = s[i++] ;) if ((n = hay.indexOf(l, n)) === -1) return false; | |
return true; | |
}; |
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
<? | |
/** | |
* @param String $str The input string | |
* @return String The string without accents | |
*/ | |
function removeAccents( $str ) | |
{ | |
$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', | |
'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', | |
'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', |
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
<? | |
/** | |
* Custom version of the json_decode native function to allow comments in | |
* the config file. | |
*/ | |
function json_clean_decode($json, $assoc = false, $depth = 512, $options = 0) { | |
// search and remove comments like /* */ and // | |
$json = preg_replace("#(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|([\s\t]//.*)|(^//.*)#", '', $json); | |
if(version_compare(phpversion(), '5.4.0', '>=')) { |
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
// --- Cross-browser transparent background trick thanks to | |
// http://hammerspace.co.uk/2011/10/cross-browser-alpha-transparent-background-css | |
.bg-alpha(@color, @opacity) { | |
@alphaColour: hsla(hue(@color), saturation(@color), lightness(@color), @opacity); | |
@ieAlphaColour: argb(@alphaColour); | |
background:@color; | |
background: transparent\9; | |
background: rgba(red(@color), green(@color), blue(@color), @opacity); | |
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d',endColorstr='%d')", @ieAlphaColour, @ieAlphaColour)); | |
zoom: 1 |
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
/** | |
* Matches a string over the other in a fuzzy word-by-word fashion. | |
* The needle matches the haystack if the haystack contains all the words | |
* of the needle in any order. | |
* | |
* @param String $haystack The string to search in. | |
* @param String $needle The string that has to be searched for in the | |
* haystack. | |
* @return Boolean true if the needle matches the haystack, false | |
* otherwise. |
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
(function($) { | |
$.fn.extend( { | |
limiter: function(limit, elem) { | |
$(this).on("keyup focus", function() { | |
setCount(this, elem); | |
}); | |
function setCount(src, elem) { | |
var chars = src.value.length; | |
if (chars > limit) { | |
src.value = src.value.substr(0, limit); |
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
define({ | |
map:{ | |
'*': { 'nav': 'custom/header/nav.custom' } | |
} | |
}); |
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
build: { | |
options: { | |
paths: [ // Where to look for files to @import | |
"app/styles/" | |
] | |
}, | |
files: [ | |
// @see http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically | |
{ | |
expand: true, // Enable dynamic expansion. |
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
define(['require', 'backbone', 'collections/c_tags'], function(require) { | |
"use strict"; | |
var Backbone = require('backbone'); | |
var TagsCollection = require('collections/c_tags'); | |
return Backbone.Model.extend({ | |
tagsCollection: null, | |
url: function() { |
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
define(['require', 'backbone.marionette', 'handlebars', | |
'constants/events', 'text!../templates/v_btn.html', | |
'css!../styles/buttons.css'], | |
function (require) { | |
'use strict'; | |
var Backbone = require('backbone'); | |
var Marionette = require('backbone.marionette'); | |
var Handlebars = require('handlebars'); | |
var Events = require('constants/events'); |
OlderNewer