Skip to content

Instantly share code, notes, and snippets.

View knxroot's full-sized avatar

Gustavo Lacoste knxroot

View GitHub Profile
@knxroot
knxroot / rut-flask-restful-validation
Last active August 29, 2015 14:26 — forked from rbonvall/rut.py
Dígito verificador del RUT en Python
# encoding=utf-8
# Idea of a Custom data types for validate the Chilean RUT in Flask-RESTful
# by @lacosox
from itertools import cycle
#rut='XXXXXXXX-X'
def chilean_rut(rut_text):
rut_text.upper().strip().replace(".", "").replace("K", "10")
(rut, dv)=rut_text.split('-')
@knxroot
knxroot / persona_adv.js
Created November 11, 2012 21:10
JS_POO Base
window.Persona = window.Persona || {};
window.Persona = (function () {
"use strict";
function Persona() {
}
var nombre = "";
Persona.prototype.getNombre = function () {
pensar('Entrego mi nombre<br/>');
@knxroot
knxroot / w3c_autovalidar.sh
Created November 11, 2012 21:14
w3c_autovalidar
extract () {
if [ -f $1 ];
then
case $1 in
*.tar) tar -xvf $1 ;;
*.tgz) tar -xvzf $1 ;;
*.tar.gz) tar -xvzf $1 ;;
*.tbz2) tar -xvjf $1 ;;
*.tar.bz2) tar -xvjf $1 ;;
*.gz) gunzip $1 ;;
@knxroot
knxroot / gist:4056320
Created November 11, 2012 21:25
HTML5:webstorage ejemplo básico
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web Storage</title>
<script type="text/javascript">
function almacenar()
{
if (typeof(Storage)!=='undefined')
{
@knxroot
knxroot / persona.js
Created November 11, 2012 21:12
JS_OO Base
var Persona = {
nombre: "",
getNombre: function(){
this.pensar('Entrego mi nombre<br/>');
return this.nombre;
},
setNombre: function(nombre){
this.pensar('Cambio mi nombre<br/>');
this.nombre=nombre;
},
@knxroot
knxroot / coloresbash.sh
Created November 11, 2012 21:38
colores en bash
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
@knxroot
knxroot / gist:4056328
Created November 11, 2012 21:28
HTML5:canvas ejemplo básico
<!DOCTYPE html>
<html lang="en">
<head>
<title>Prueba Canvas</title>
<script type="text/javascript">
function dibujar()
{
var canvas=document.getElementById('miCanvas');
var ctx=canvas.getContext('2d');
ctx.fillRect(100,100,200,50);
@knxroot
knxroot / gist:4056369
Created November 11, 2012 21:46
recursos_paraalumnos_desarrolloweb
@knxroot
knxroot / gist:4056325
Created November 11, 2012 21:28
HTML5:svg ejemplo básico
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SVG</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect x="100" y="100" width="200" height="100" style="stroke:#FF0000; fill:#FF0000;"/>
<polygon points="100,100 150,50 200,100 250,50 300,100" style="stroke:#FF0000; fill:#FF0000;" />
@knxroot
knxroot / translate.sh
Created November 11, 2012 21:16
google translate from bash
help='translate <text> [[<source language>] <target language>]
if target missing, use DEFAULT_TARGET_LANG
if source missing, use auto'
# adjust to taste
DEFAULT_TARGET_LANG=en
if [[ $1 = -h || $1 = --help ]]
then
echo "$help"