Skip to content

Instantly share code, notes, and snippets.

import threading
def daemonize(f):
def wrapper(*args, **kwargs):
tgt = f
t= threading.Thread(target=tgt, args=args, kwargs=kwargs)
t.setDaemon(True)
t.start()
return wrapper
#and you use it like this:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = [email protected]:you/HelloRadWorld.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "gitorious_backup"]
url = [email protected]:you/HelloRadWorld.git
$(function(){
var converter = new Showdown.converter();
function update_description_preview(){
$('#preview').html(converter.makeHtml($("#id_body").val()));
}
$("#id_body").keyup(function(){
update_description_preview();
});
});
WSGIPythonEggs /var/root/
<VirtualHost *:80>
ServerAdmin webmaster@localhost
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /home/ruta/a/proyecto/django.wsgi
WSGIPassAuthorization On
DocumentRoot /var/www
Alias /static/ /home/ruta/a/proyecto/static/
<Directory /home/ruta/a/proyecto/static>
class OhMyGod
constructor: (@name)->
setInterval(->
alert "I'm"+@name+" and I annoy"
,3000)
divide: (n1, n2)->
n1/n2 unless n2 is 0 and n1?
var OhMyGod;
OhMyGod = function(_a) {
this.name = _a;
setInterval(function() {
return alert("I'm"+this.name+"I annoy");
}, 3000);
return this;
};
OhMyGod.prototype.divide = function(n1, n2) {
if (!(n2 === 0 && (typeof n1 !== "undefined" && n1 !== null))) {
@lfborjas
lfborjas / disqus_comment_count.haml
Created September 11, 2010 08:28
The generic code to use disqus comments, adapted to haml
:javascript
var disqus_shortname = 'YOUR-SITE';
(function () {
var s = document.createElement('script'); s.async = true;
s.src = 'http://disqus.com/forums/YOUR-SITE/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
#to also process text files
./manage.py makemessages -ae ".html" -e ".py" -e ".txt"
@lfborjas
lfborjas / app.rb
Created October 5, 2010 03:46
Progra4: El ejemplo básico de la clase del 5 de octubre de 2010
require 'sinatra'
get '/' do
"¡hola mundo!"
end
get '/agua' do
send_file "hola.html"
end
@lfborjas
lfborjas / Conjuntos.java
Created October 5, 2010 05:24
Ejemplos del 5 de octubre de 2010
package ejercicios;
import java.util.ArrayList;
import java.util.Arrays;
public class Conjuntos{
private static ArrayList<String> union1(ArrayList<String> primero, ArrayList<String> segundo){
ArrayList<String> retVal = new ArrayList<String>(primero);
for(String worte: segundo){
if(!primero.contains(worte))
retVal.add(worte);