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
//From http://stackoverflow.com/questions/12606245/detect-if-browser-is-running-on-an-android-or-ios-device | |
var isMobile = { | |
Android: function() { | |
return /Android/i.test(navigator.userAgent); | |
}, | |
BlackBerry: function() { | |
return /BlackBerry/i.test(navigator.userAgent); | |
}, | |
iOS: 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
python -m SimpleHTTPServer |
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
/* https://dev.twitter.com/cards/types */ | |
<meta name="twitter:card" content="photo" /> | |
<meta name="twitter:title" content="Découvrez le nouveau calendrier de l'avent #Milka" /> | |
<meta name="twitter:description" content="Comptez les nuit jusqu'à Noël grâce au nouveau calendrier de l'avent #Milka et découvrez des surprises sur avent.milka.fr" /> | |
<meta name="twitter:image" content="https://avent.milka.fr/img/tcard.jpg" /> | |
<meta name="twitter:url" content="https://avent.milka.fr" /> |
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
// Pour les retours à la ligne mettre \n | |
// %c applique du css. A chaque %c, ca applique le css suivant, | |
// donc de 'Made by Creaktif' a '\n' ca applique 'background: #cdcdcd; color: #fff' | |
// et après celui ci 'background: #8a8a8a; color: #fff', car il y a de nouveau un %c après le \n | |
console.log('%c MADE BY CREAKTIF \n%c www.creaktif.com ', 'background: #cdcdcd; color: #fff', 'background: #8a8a8a; color: #fff'); |
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
var r = Math.random(); | |
var randomPoint = { | |
'x': (1-r)*this.v1.x + r*this.v2.x, | |
'y' : (1-r)*this.v1.y + r*this.v2.y | |
} | |
//Where v1 & v2 are the two points defining the line. |
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
var img = new Image(); | |
img.src = canvas.toDataURL(); | |
document.body.appendChild(img); |
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
export PATH=/mongo/bin:$PATH | |
export PATH=/phantomjs/bin:$PATH | |
function tabname { | |
printf "\e]1;$1\a" | |
} | |
function winname { | |
printf "\e]2;$1\a" | |
} |
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 checkAlpha(word) { | |
var newStr = word.replace(/(^\s+|\s+$)/g,''); | |
if (newStr.length > 0) { | |
if (/[^A-Za-zàáâãäåæçèéêëæìíîïñòóôõöøßùúûüÿÀÁÂÃÄÅÆÇÈÉÊËÆÌÍÎÏÑÒÓÔÕÖØßÙÚÛÜŸ \-']/.test(newStr)) return false; | |
else return true; | |
} else return false; | |
} |
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 checkNumber(testedString) { | |
var newStr = testedString.replace(/(^\s+|\s+$)/g,''); | |
if (newStr.length > 0) { | |
if (/[^0-9]/.test(newStr)) return false; | |
else return true; | |
} else return false; | |
} |
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
//From http://cwestblog.com/2012/11/12/javascript-degree-and-radian-conversion/ | |
// Converts from degrees to radians. | |
Math.radians = function(degrees) { | |
return degrees * Math.PI / 180; | |
}; | |
// Converts from radians to degrees. | |
Math.degrees = function(radians) { | |
return radians * 180 / Math.PI; |