Skip to content

Instantly share code, notes, and snippets.

View diegotoral's full-sized avatar

Diego Toral diegotoral

View GitHub Profile

Keybase proof

I hereby claim:

  • I am diegotoral on github.
  • I am diegotoral (https://keybase.io/diegotoral) on keybase.
  • I have a public key ASCkzy31yRtkMM2Sx-RxsI51TRikrlEmqEJJNDSaYp3sHQo

To claim this, I am signing this object:

--regex-ruby=/^[ \t]*describe ['"](.*)['"] do/\1/d,rspec describe/
--regex-ruby=/^[ \t]*context ['"](.*)['"] do/\1/C,rspec context/
--regex-ruby=/^[ \t]*it ['"](.*)['"] do/\1/i,rspec tests/
@diegotoral
diegotoral / elasticsearch.rb
Last active August 29, 2015 14:09
ElasticSearch 1.2.4 (Mac OS brew formule)
require 'formula'
class Elasticsearch < Formula
homepage 'http://www.elasticsearch.org'
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.4.tar.gz'
sha1 'c8bbe1f1975ffb6774744fadd0abb78616e96904'
head do
url 'https://gist.github.com/diegotoral/ec2a520c7087a6dea5ed'
depends_on 'maven'
# -*- coding: utf-8 -*-
import random
leet = {
'a': ['4', '/\\', '@', '/-\\', '^', '\xc3\xa4', '\xc2\xaa', 'aye'],
'b': ['8', '6', '|3', '\xc3\x9f', 'P>', '|:'],
'c': ['[', '\xc2\xa2', '<', '('],
'd': ['|))', 'o|', '[)', 'I>', '|>', '?'],
'e': ['3', '&', '\xc2\xa3', '\xc3\xab', '[-', '\xe2\x82\xac', '\xc3\xaa', '|=-'],
describe('NewActivityView', function() {
var view;
beforeEach(function() {
jasmine.getFixtures().fixturesPath = '';
loadFixtures('index.html');
view = new app.NewActivityView();
});
it('should bind $el to the right DOM element', function() {
@app.route('/<ObjectId:task_id>')
def show_task(task_id):
task = mongo.db.tasks.find_one_or_404(task_id)
return render_template('task.html', task=task)
@diegotoral
diegotoral / Preferences.json
Created February 21, 2014 16:46
Sublime Text 3 - User Preferences
{
"word_wrap": "true",
"color_scheme": "Packages/Theme - Phoenix/Color Scheme/Clouds Midnight.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 10,
"highlight_line": true,
"ignored_packages":
[
"Handlebars",
"Jade",
@diegotoral
diegotoral / signal.py
Created November 11, 2013 02:36
A simple signal class for Python.
class Signal(object):
"""
Signal class.
"""
def __init__(self, sender):
super(Signal, self).__init__()
self.sender = sender
self.listeners = []
def connect(self, callback):
@diegotoral
diegotoral / .bashrc
Last active December 16, 2015 11:29
Personalized .bashrc file. Shows current branch for git repositories
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
@diegotoral
diegotoral / s_sum.c
Last active December 15, 2015 13:59
Seja S uma sequência cujos valores iniciais são {1,1,2,4,3,9,4,16,5,...}. Escreva um programa que, dado um número n (lido da entrada padrão), envia para a saída padrão a soma nos n primeiros números da sequência S.
#include <stdio.h>
int s (int x)
{
if (x == 0)
return 0;
else if (x == 1)
return 1;
else
return x * x;