Skip to content

Instantly share code, notes, and snippets.

class Dog < Animal
def pet
dog_petter.pet
end
private
def dog_petter
DogPetter.new
end
end
function activarFormulario(){
var form = document.querySelector("form");
form.addEventListener("submit", function(event) {
event.preventDefault();
var r = document.getElementById("result");
var n = document.getElementById("GET-nombre");
r.textContent = n.value;
});
}
@lfborjas
lfborjas / luis.vim
Created January 26, 2015 16:09
vimrc
syntax on
autocmd Filetype html setlocal ts=2 sw=2 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
autocmd Filetype cucumber setlocal ts=2 sw=2 expandtab
set noswapfile
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.md.html set filetype=markdown
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 = git@github.com:you/HelloRadWorld.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "gitorious_backup"]
url = git@gitorious.org: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);
}());