Skip to content

Instantly share code, notes, and snippets.

@hcosta
hcosta / test.py
Created October 22, 2013 09:40
Testing GistHub
print "Hello World"
@hcosta
hcosta / clone_html.js
Last active December 27, 2015 12:19
Clone all html elements in a div with all form values dinamically
/* Requires jQuery*/
function clone(from, to){
// Do this before clone
$('[type=text], textarea').each(function(){ this.defaultValue = this.value; });
$('[type=checkbox], [type=radio]').each(function(){ this.defaultChecked = this.checked; });
$('select option').each(function(){ this.defaultSelected = this.selected; });
@hcosta
hcosta / symbolic
Last active August 29, 2015 13:56
Symbolic link in linux
// Enlace simbólico en GNU/Linux
$ ln -s /ruta/directorio/original /ruta/directorio/destino
@hcosta
hcosta / pip
Created February 14, 2014 18:21
install python git repo directly
pip install https://github.com/user/repo/zipball/master
or
pip install https://github.com/user/repo/tarball/master
@hcosta
hcosta / ej001.html
Last active August 29, 2015 13:56
ejemplo 1
<!-- Creamos nuestro lienzo canvas de 300x100 pixels -->
<canvas height="100" id="canvas" width="300"></canvas>
<!-- Creamos el javascript para dibujar nuestro Hola Mundo -->
<script type="text/javascript">
// Definimos un evento que espere que se carga la
// página (load) antes de ejecutar nuestro script
window.addEventListener('load', function () {
@hcosta
hcosta / xorg
Created March 8, 2014 22:54
xorg new config
Xorg.conf does not exist by default any more
Boot into recovery mode and select Root Shell. Then run:
X -configure
Then:
cp /root/xorg.conf.new /etc/X11/xorg.conf
$ cd project
$ nano package.json
{
"name": "",
"version": "",
"description": "",
"main": "index.html",
"author": "",
@hcosta
hcosta / votos.py
Created March 17, 2014 21:28
contador de votos totales
# polls/templatetags/poll_extras.py
from django import template
from polls.models import Choice, Poll
register = template.Library()
@register.filter(name='total_votes')
def total_votes(poll):
total = 0 # contador
@hcosta
hcosta / phonegap
Last active August 29, 2015 13:57
instalation
export PATH=${PATH}:~/sdk/platform-tools:~/sdk/tools
@hcosta
hcosta / gist:e12d002cdef46d4471e5
Created May 3, 2014 13:56
Timezone definition issue in Django 1.6
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
service mysql restart