Skip to content

Instantly share code, notes, and snippets.

Avatar
😎

Hernán Beiza hernanBeiza

😎
View GitHub Profile
View gist:cfcd7e0146f7fe83d1ddf14580e12da1
#Agregar en las opciones de la VM
-XX:+UseSerialGC -Xss512k -XX:MaxRAM=256m
@hernanBeiza
hernanBeiza / filtrarDosArreglos.js
Last active Nov 5, 2020
TS - Filtar dos arreglos
View filtrarDosArreglos.js
const todosLosUsuarios = [{ userid: "100", nombre: "NN", rowid: "0" },{ userid: "101", nombre: "HB", rowid: "1" },{ userid: "102", nombre: "Marcus", rowid: "2" }];
const usuariosFiltro = [{ userid: "101", nombre: "HB", rowid: "1" }];
console.log("todosLosUsuarios", todosLosUsuarios);
console.log("usuariosFiltro", usuariosFiltro);
const encontrados = todosLosUsuarios.filter(array => !usuariosFiltro.some(filter => filter.userid !== array.userid));
console.log("encontrados", encontrados);
@hernanBeiza
hernanBeiza / Clip.as
Created Dec 30, 2014
AS3 - Vaciar MovieClip
View Clip.as
//Vaciar el contenedor
private function vaciarContenedor(contenedor:MovieClip):void {
//Borrar todos los objetos en el contenedor
for (var i:int = contenedor.numChildren - 1; i >= 0; i--){
contenedor.removeChildAt(i);
}
}
View ViewController.m
float r; float g; float b; float a;
[UIColor colorWithRed:r/255.f
green:g/255.f
blue:b/255.f
alpha:a/255.f];
@hernanBeiza
hernanBeiza / Main.as
Created Dec 30, 2014
AS3 - ScrollBar
View Main.as
public var sb:ScrollBar = new ScrollBar;
public var mcContenido:MovieClip;
public var mcMask:MovieClip;
private function configScroll():void {
//Config Scroll
//trace("Configurar Scroll");
sb.x = 20+mcContenido.x + mcContenido.width;
sb.y = mcContenido.y;
sb.height = mcMask.height;
@hernanBeiza
hernanBeiza / UIViewController.m
Created Dec 30, 2014
Objective C - Retain Count
View UIViewController.m
CFIndex rc = CFGetRetainCount((__bridge CFTypeRef)myObject);
NSLog(@"%li",rc);
@hernanBeiza
hernanBeiza / Abrir.as
Created Dec 30, 2014
AS3 - Abrir URL
View Abrir.as
var url:String="ruta.html";
navigateToURL(new URLRequest(url), "_blank");
@hernanBeiza
hernanBeiza / Random.as
Created Dec 30, 2014
AS3 - Rango Random
View Random.as
internal function rangoRandom(low:Number,high:Number):Number {
var numeroRandom:Number = Math.floor(Math.random() * (high - low)) + low;
//trace("Numero Random: " + numeroRandom);
return numeroRandom;
}
@hernanBeiza
hernanBeiza / Triangulo.as
Created Dec 30, 2014
AS3 - Punto random en un triángulo
View Triangulo.as
//Créditos
//http://labs.grupow.com/index.php/2009/05/random-points-inside-a-triangle/
function getRandomPointInTriangle (A:Point,B:Point,C:Point):Point {
//P = aA + bB + cC
//@see http://www.cgafaq.info/wiki/Random_Point_In_Triangle
var a:Number = Math.random();
var b:Number = Math.random();
@hernanBeiza
hernanBeiza / Main.as
Created Dec 30, 2014
AS3 - Obtener Extensión Archivo MAC
View Main.as
public static function extractFileType(fileName:String):String {
var extensionIndex:Number = fileName.lastIndexOf(".");
if (extensionIndex == -1) {
return "";
} else {
return "." + fileName.substr(extensionIndex + 1, fileName.length);
}
}
//Thanks to