Skip to content

Instantly share code, notes, and snippets.

@fadomire
fadomire / Tokenahead.css
Last active December 10, 2015 00:58 — forked from fat/Tokenahead.less
Tags input : Added some features i needed for my use, based on Fat https://gist.github.com/2411033 implementation like : comma will now trigger a new tag, a cloned input is created and original input gets updated with tags value, some css tweaks...
.tokenahead {
cursor: text;
overflow: hidden;
height: auto;
padding-bottom: 0;
border-color:#ccc;
background-color:white;
}
.focus{
border-color: rgba(82, 168, 236, 0.8);
<style>
.thumb {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
</style>
<input type="file" id="files" name="files[]" multiple />
<output id="list"></output>
@fadomire
fadomire / urlParamTool
Created July 15, 2013 08:53
get / set / delete url parameter javascript
getUrlParameter: function (name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
},
setUrlParameter: function (name, value) {
var search;
if(this.getUrlParameter(name)){
search = location.search.replace(new RegExp('([?|&]'+name + '=)' + '(.+?)(&|$)'),"$1"+encodeURIComponent(value)+"$3");
}else if(location.search.length){
search = location.search +'&'+name + '=' +encodeURIComponent(value);
}else{
@fadomire
fadomire / country-list-fr
Last active December 19, 2015 19:59
List of countries in french
"ZA-Afrique Du Sud",
"AF-Afghanistan",
"AL-Albanie",
"DZ-Algérie",
"DE-Allemagne",
"AD-Andorre",
"AO-Angola",
"AI-Anguilla",
"AQ-Antarctique",
"AG-Antigua-et-barbuda",
@fadomire
fadomire / index.html
Created August 29, 2013 14:20
circular progres bar with Raphael
<!doctype html>
<script src="raphael.js"></script>
<body>
<div id="progressBar"> </div>
</body>
@fadomire
fadomire / formToObject.js
Last active December 27, 2015 10:59
Form to Object
var arr = $('#myForm').serializeArray();
var data = _(arr).reduce(function(acc, field) {
acc[field.name] = field.value;
return acc;
}, {});
@fadomire
fadomire / maxInArray.js
Created November 27, 2013 10:16
javascript Max value in Array
Math.max.apply( Math, Array )