This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>XMPP with JavaScript</title> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js'></script> | |
<script src='strophe.js'></script> | |
<script> | |
var BOSH_SERVICE = 'http://nodebosh.herokuapp.com'; | |
var connection = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module StringCalculator | |
def add | |
return 0 if empty? | |
raise "Negatives not allowed: #{ negative_numbers.join(",") }" unless negative_numbers.empty? | |
retrieve_numbers.reduce(0) {|total,number|total+number} | |
end | |
def retrieve_numbers | |
@retrieve_numbers ||= split(/[\n#{delimiter}]/).map(&:to_i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------------ | |
# FILE: osx.plugin.zsh | |
# DESCRIPTION: oh-my-zsh plugin file. | |
# AUTHOR: Sorin Ionescu ([email protected]) | |
# VERSION: 1.0.1 | |
# ------------------------------------------------------------------------------ | |
function tab() { | |
local command="cd \\\"$PWD\\\" && clear" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cl() { | |
cd $1; | |
clear; | |
ls; | |
echo "" | |
} | |
function hack() { | |
function ~/1337/$1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local blue_op="%{$fg[blue]%}[%{$reset_color%}" | |
local blue_cp="%{$fg[blue]%}]%{$reset_color%}" | |
local path_p="${blue_op}%~${blue_cp}" | |
local user_host="${blue_op}%n@%m${blue_cp}" | |
local git_branch='$(git_prompt_info)%{$reset_color%}' | |
local rvm_branch='$(rvm_prompt_info)' | |
local ret_status="${blue_op}%?${blue_cp}" | |
local hist_no="${blue_op}%h${blue_cp}" | |
local smiley="%(?,%{$fg[green]%}:D$reset_color%},%{$fg[red]%}:@%{$reset_color%})" | |
PROMPT="╭─${path_p} ${user_host} ${rvm_branch} ${git_branch} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code sanitized to protect the foolish. | |
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Reflection; | |
using System.Web.UI; | |
namespace Mobile.Web.Control | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; La idea es poder hacer algo como yasnippets (fácil de configurar, independiente de un modo) para comandos. | |
;; Entonces poder hacer algo como: | |
(lola-runs-on 'rails-minor-mode | |
("Run rake db:migrate" | |
:shortcut "C-c D" | |
:run "rake db:migrate" | |
;; project folder funciona como en textmate.el, busca el .git mas cercano. Tambien esta current-buffer-folder. De hecho project-folder es por default | |
:on project-folder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:password=>"39c8e9953fe8ea40ff1c59876e0e2f28", "username"=>"mitasdf", "password"=>"sdfsdfsdfsdf", "email"=>"[email protected]"} | |
Es que pensé que se usaba [:password] en params (como rails). Nada más usá "password" en lugar de :password: | |
def encript(hash) | |
# Devuelve el mismo hash, pero haciéndole digest al password | |
hash["password"] = Digest::MD5.hexdigest(hash["password"]) | |
return hash | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Primero te recomiendo hacer un método 'encript' así: | |
def encript(hash) | |
# Devuelve el mismo hash, pero haciéndole digest al password | |
hash[:password] = Digest::MD5.hexdigest(hash[:password]) | |
return hash | |
end | |
# De esa manera podés hacer esto: | |
post '/signup' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
include DataMapper::Resource | |
has n, :projects | |
end | |
class Project | |
include DataMapper::Resource | |
belongs_to :user, :key => true | |
has n, :steps |