Skip to content

Instantly share code, notes, and snippets.

@samatsav
samatsav / 'indexOf' method for IE
Created October 21, 2013 12:52
functia indexOf --- pt versiunile IE < 8.0 (lipseste)
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
if (from < 0)
from += len;
@samatsav
samatsav / ro_slugs.php
Created October 21, 2013 13:31
Inlocuieste diacriticele cu caractere compatibile ASCII. (@@todo: inainte de a folosii functia, a se scoate din $map conversiile in plus)
function ro_slugs($cuvant) {
$slug = trim(strtolower(stripslashes($cuvant)));
$map = array(
'/à|á|å|â|ă|â|Â|Ă|ă/i' => 'a',
'/è|é|ê|ẽ|ë/i' => 'e',
'/ì|í|î|î|Î|Î/i' => 'i',
'/ò|ó|ô|ø/i' => 'o',
'/ù|ú|ů|û/i' => 'u',
'/ș|ș|ş|Ș|Ș|Ş/i'=>'s',
@samatsav
samatsav / 0_reuse_code.js
Created August 29, 2014 07:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console