Skip to content

Instantly share code, notes, and snippets.

View joseluistorres's full-sized avatar
🤠
Como te ves me vi, como me veo te verás...

JoséLuis Torres joseluistorres

🤠
Como te ves me vi, como me veo te verás...
View GitHub Profile
@joseluistorres
joseluistorres / bash.sh
Created March 14, 2014 16:04
git checkout branchname and copy that to use later
# add this to your bash profile
function gco1() {
echo "$@" | pbcopy | gco "$@"
}
alias gco='git checkout'
@joseluistorres
joseluistorres / geometry_error.sql
Last active August 29, 2015 14:01
public.geometry(MultiLineString,3857) does not exist
-- If you have an error running a query with geometry in Postgresql
CREATE TABLE "some_random_table" (
"id" int4 NOT NULL,
"map_coords" "public"."geometry(MultiLineString,3857)",
"col3" int4 NOT NULL,
@joseluistorres
joseluistorres / tests_controller.rb
Created September 15, 2014 20:55
then I want a method that is executed for create / edit actions, that use @my_var1, and can set variables available in the view.
class TestsController < ApplicationController
before_filter :execute_me, :only => :index
def index
@my_var2 = translate_me('ES', @my_var)
end
private
def execute_me
defmodule Ph_14Version.Field do
use Ph_14Version.Web, :model
use Ecto.Model.Callbacks
before_insert :set_map_coords
schema "fields" do
field :name, :string
field :map_coords, Geo.MultiPolygon
@joseluistorres
joseluistorres / gist:5743586
Created June 9, 2013 13:41
RubyGDL Reunión Mensual Junio 13, 2013
require 'rubygdl'
require 'hackergarage'
require 'more/people'
describe RubyGDL::ReunionMensual do
it 'should be at 7pm CDT in HG'
Me.goTo(HackerGarage.place).onTime.should be_true
@joseluistorres
joseluistorres / gist:5810744
Created June 19, 2013 00:25
HIDE YOUR SINS
def get_campaign_language(language)
begin
languages = []
if language
@campaign.languages << Language.find_by_lang_code(language)
languages << language
end
return languages
rescue StandardError => e
puts e #HIDEYOURSINS
@joseluistorres
joseluistorres / RemoveMe
Created July 31, 2013 13:54
Scary Code
def restore_record
if params[:model] && params[:id]
begin
const_class = params[:model].upcase
a_record = const_class.constantize.send("only_deleted").send('find',params[:id])
a_record.recover
rescue Exception => e
logger.info "Restore error:#{e}"
end
end
@joseluistorres
joseluistorres / my_bob.rb
Created August 6, 2013 03:57
First Bob version
module StringValidations
def contains_hyphens_and_period_at_end?(str)
str.match(/\-|\.$/)
end
def contains_uppercase_words?(str)
str.match(/[A-Z]{2,}/)
end
@joseluistorres
joseluistorres / rubyagostothor
Last active December 20, 2015 20:28
Resuelve el acertijo de @hackergil
#! /usr/bin/env ruby
require 'thor'
class Test < Thor
desc "create", "Creates an empty git repository"
def create(dirname)
puts "Creating git repository"
FileUtils.mkdir dirname

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.