Skip to content

Instantly share code, notes, and snippets.

@caike
caike / install-ruby-1.8.7.sh
Last active September 18, 2017 19:34 — forked from wmakley/install-ruby-1.8.7.sh
Install Ruby 1.8.7 on Mac OSX 10.12 Sierra with rbenv
#!/bin/sh
# The main issues with Ruby 1.8.7 are that it won't build with Clang,
# and the Net::HTTPS module won't work with modern versions of OpenSSL.
#
# This assumes you have already set up homebrew, and run: xcode-select --install
#brew install homebrew/dupes/apple-gcc42
#brew install libyaml libffi
brew install https://github.com/Homebrew/homebrew-versions/raw/586b7e9012a3ed1f9df6c43d0483c65549349289/openssl098.rb
export CC=/usr/local/bin/gcc-4.2
@caike
caike / cart.exs
Created August 30, 2016 21:56 — forked from dtzitz/cart.exs
# from ounce of elixir
#https://www.meetup.com/Women-Who-Code-Tampa/events/233014583/
ExUnit.start
defmodule CartTest do
use ExUnit.Case
test "starts with empty count" do
assert Cart.count_items([]) == 0
@caike
caike / import.rb
Created September 23, 2013 23:57 — forked from evanwalsh/import.rb
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'safe_yaml'
require 'time'
module JekyllImport
# This importer takes a wordpress.xml file, which can be exported from your
@caike
caike / decorators_poro.rb
Created October 26, 2012 12:49
Decorators
class Poet
def produce_art(inspiration)
"#{inspiration} !"
end
end
class ArtistDecorator < Struct.new(:artist)
def produce_art(inspiration)
artist.produce_art(inspiration)
end
@caike
caike / lab4.html
Created April 15, 2011 14:08 — forked from jcasimir/lab4.html
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
</head>
<body>
<h1>Flight</h1>
<h2>Logistics</h2>
<table id="logistics">
<tbody>
<tr id='time'>
# Even when you create objects they should be properly scoped... Remember this example?
t = Tweet.new
t.status = "RT #{@tweet.user.name}: #{@tweet.status}"
t.original_tweet = @tweet
t.user = current_user
t.save
# A simplified version of this, properly scoped might look like this:
# A user has many tweets.. and sometimes we want to retweet.
class TweetsController < ApplicationController
def retweet
@tweet = Tweet.find(params[:id])
if @tweet.user == current_user
flash[:notice] = "Sorry, you can't retweet your own tweets"
elsif @tweet.retweets.where(:user_id => current_user.id).present?
<!--
ATENÇÃO: os links estão ordenados alfabeticamente. Siga esta nomenclatura ao adicionar o seu.
-->
<h2>#horaextra</h2>
<ul id="blogroll">
<li><a href="http://caikesouza.com/?utm_campaign=horaextra">Caike Souza</a></li>
<li><a href="http://tapajos.me/?utm_campaign=horaextra">Marcos Tapajós</a></li>
<li><a href="http://rafael.adm.br/?utm_campaign=horaextra">Rafael Lima</a></li>
<li><a href="http://rafael.tauil.com.br/?utm_campaign=horaextra">Rafael Tauil</a></li>
<li><a href="http://ramonpage.com/?utm_campaign=horaextra">Ramon Bispo</a></li>