Skip to content

Instantly share code, notes, and snippets.

View abimaelmartell's full-sized avatar

Abimael Martell abimaelmartell

View GitHub Profile
@aalvarado
aalvarado / .psqlrc
Last active August 29, 2015 14:03
postgresql DEVELOPMENT configuration
\pset null 'NULL'
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 100000
\timing
\set PROMPT1 '(%n@%M:%>) [%/] > '
\set PROMPT2 ''
\encoding unicode
\timing
\pset pager always
\setenv LESS '-iMSsx2 -FX'
Person = {
instance: function(name, lastname)
{
var base = this;
base._private = {}
base._public = {}
base._private.name = name;
base._private.lastname = lastname;
@mhcornejo
mhcornejo / test.js
Created July 10, 2012 20:14
Imprimir los numeros del 1 al 1000 sin bucles o condiciones
var functions = {
a1: function (number, max) { return print(number + 1, max); },
aNaN: function (number, max) { return null;}
};
function print(number, max){
document.write(number + '<br />');
var left = max - number;
var index = left/left;
return functions['a' + index.toString()](number, max);
}
@javierg
javierg / gist:4742784
Created February 8, 2013 23:21
Fortune Teller Machine
class FortuneTellerMachine
WELCOME = "Hola ¿Quiéres saber tu fortuna?"
REQUEST = "Fortuna por monedas, yo quiero yo quiero monedas (2): "
CHANGE_BACK = "Here is your change"
COST = 2
def initialize
clear
end
@ZephiroRB
ZephiroRB / extract.rb
Last active December 12, 2015 10:29 — forked from abimaelmartell/texto.rb
Ejemplo de Iteración de archivo, gracias a abimael martel
a = File.read './legal.txt'
b = a.force_encoding("ISO-8859-1").encode("utf-8", replace: nil).scan(/inicio([\s\S]+?)fin/)
c = []
b.each do |r|
d = {}
d[:fecha] = r.to_s.scan(/Lima, el (.+?),/).join
@puffnfresh
puffnfresh / where_tdd_fails.md
Last active December 14, 2015 13:39
Where TDD Fails (mirror for http://blog.precog.com/?p=431)

Where TDD Fails

I've just gotten back from the awesome mloc.js conference. There was a talk about compiling C# to JavaScript and one of the benefits explained was static types. Someone from the audience asked, who needs types when you do Test Driven Development?

I tried to address the question in my talk on Roy but I talked to some developers afterwards and they thought that TDD

require 'minitest_helper'
feature 'User Login Test' do
background do
Rails.application.config.authentication_domain = 'user.com'
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(
{ 'provider' => 'google_oauth2', 'uid' => '12334',
'info' => { 'name' => 'Test user', 'email' => 'test@user.com' }
}
@chipotle
chipotle / deploy.rb
Last active February 8, 2018 18:54
Capistrano deployment script for Laravel 4
# Capistrano Laravel 4 Deployment Tasks
# Watts Martin (layotl at gmail com)
# https://gist.github.com/chipotle/5506641
# updated 14-Aug-2013
# Assumptions:
#
# - You are using a .gitignore similar to Laravel's default, so your
# vendor directory and composer(.phar) are *not* under version control
# - Composer is installed as an executable at /usr/local/bin/composer
@tonycoco
tonycoco / image_filters.rb
Created June 11, 2012 15:04
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
class GroupersController < ApplicationController::Base
def create
@grouper = Grouper.new(leader: current_member)
if @grouper.save
confirm_grouper_via_emails(@grouper)
enqueue_bar_assignment(@grouper)
redirect_to home_path
else