Skip to content

Instantly share code, notes, and snippets.

@Tonetete
Tonetete / remove_quotes_keys_json.js
Created May 5, 2017 09:44
Remove quotes from keys JSON object to match es6 specifiactions
var a='{"Table" : [{"userid" : "11","name" : "KumarP","designation" : "Business Head","phone" : "9789234793","email" : "surfingkumar@gmail.com","role" : "Admin", "empId" : "EI003","reportingto" : "KumarP"}]}';
a=a.replace(/"(\w+)"\s*:/g, '$1:');
alert(a);
@Tonetete
Tonetete / gist:a7d1c98cf61c4e24dd11
Created August 6, 2014 11:58
Problema n-reinas en python
def Reinas(solucion,etapa,n):
if etapa>=n: # si la etapa es mayor que n, entonces devolvemos falso
return False
#solucion.append(0)
exito = False # inicializamos exito a False
while True:
if (solucion[etapa] < n): # si el valor de la columna para la fila es mayor o igual que n, entonces no seguimos incrementando, con esto evitamos indices fuera del array.
@Tonetete
Tonetete / serializer-django1.6
Created June 4, 2014 10:00
Serializer Django in 1.6
In Django 1.6 you have to change the SESSION_SERIALIZER parameter to pickle. Put this in your settings.py:
SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'
I don't know when allauth will become compatible with this new Django serialization format. See Django 1.6 release notes.
@Tonetete
Tonetete / directivas
Created May 9, 2014 11:51
For allow htaccess works in the directory where is allocated.
<Directory />
AllowOverride All
Order Deny,Allow
Deny from all
</Directory>
or
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
@Tonetete
Tonetete / 0_reuse_code.js
Created April 25, 2014 21:07
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
@Tonetete
Tonetete / index.html
Created April 5, 2013 23:54
A CodePen by Adam. Tear-able Cloth - Javascript cloth simulation.
<canvas id = "c" > </canvas>
<a target="_blank" href="http://codepen.io/stuffit/pen/fhjvk" id="p">New pen: Like playing with physics? Click here!</a>
<div id="info">
<div id="top">
<a target="_blank" id="site" href="http://lonely-pixel.com">my website</a>
<a id="close" href="">close</a>
</div>
<p>