Skip to content

Instantly share code, notes, and snippets.

View bitforth's full-sized avatar

Alan Chavez bitforth

View GitHub Profile
@bitforth
bitforth / 0_reuse_code.js
Created February 7, 2014 03: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
@bitforth
bitforth / receptor.as
Last active August 29, 2015 13:56
Como enviar información de un SWF a otro en AS3
// crea conexion local
var receive_lc:LocalConnection = new LocalConnection();
// permite comunicacion entre SWFs entre diferentes dominios
receive_lc.allowDomain("*");
// Espera por conexiones entrantes.
// Este comando tiene que ejecutarse ANTES de que el otro SWF envie información.
receive_lc.connect("_connection1");
<form id="formulario-inepto" action="procesar.php" method="POST">
Nombre: <input type="text" name="nombre" placeholder="Escribe tu Nombre"/>
Telefono: <input type="tel" name="telefono" placeholder="(555)-555-5555" />
<button value="Enviar Formulario"></button>
</form>
@bitforth
bitforth / consulta.sql
Created June 10, 2014 02:50
Consulta SQL para extraer numeros de telefono de la base de datos
SELECT
nombre,
telefono
FORM
Contactos C
WHERE
C.telefono LIKE "868%";
@bitforth
bitforth / consulta2.sql
Created June 10, 2014 02:56
Consulta SQL por programadores listillos
SELECT
nombre,
telefono
FROM
Contactos C
WHERE
C.telefono LIKE "%868%";
<?php
require_once('conexion.php'); // Definicion de bases de datos y demas boberias
$nombre = substr($_POST['nombre'], 0, 49); //Truncar la cadena de texto a los primeros 50 caracteres.
$nombre - filter_var($nombre, FILTER_SANITIZE_SPECIAL_CHARS); // Codificar caracteres HTML.
$telefono = string_replace(array('+','-','.'), $_POST['telefono']);// Eliminamos caracteres especiales del telefono
$telefono = filter_var($telefono, FILTER_SANITIZE_NUMBER_INT); // Nos aseguramos que solamente queden numeros en la cadena de texto
$telefono = substr($telefono, -10); // Seleccionamos los ultimos 10 caracteres del numero, ignorando el codigo del pais.
@bitforth
bitforth / Astar.as
Created August 9, 2014 15:04
Astar
package
{
public class Astar
{
private var _abierto:Array;
private var _cerrado:Array;
private var _cuadricula:Cuadricula;
private var _nodoFinal:Nodo;
private var _nodoInicial:Nodo;
private var _ruta:Array;
@bitforth
bitforth / pathfinding.as
Created August 9, 2014 15:05
Pathfinding
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
public class pathfinding extends Sprite
{
@bitforth
bitforth / Singleton.as3
Created September 26, 2013 00:56
Como implementar Singletons en AS3
package
{
import flash.display.Sprite;
public class Singleton
{
private static var _instancia:Singleton;
public function Singleton(pvd:ClasePrivada)
{
}// Constructor vacío.
public static function instanciar():Singleton
@bitforth
bitforth / Singleton.as
Created September 26, 2013 01:09
Primera parte del tutorial de como crear Singletons en ActionScript 3
package
{
import flash.display.Sprite;
public class Singleton extends Sprite
{
public function Singleton()
{
ClasePrivada.mensaje();
}
}