Skip to content

Instantly share code, notes, and snippets.

Carlos Souza caike

Block or report user

Report or block caike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@caike
caike / install-ruby-1.8.7.sh
Last active Sep 18, 2017 — forked from wmakley/install-ruby-1.8.7.sh
Install Ruby 1.8.7 on Mac OSX 10.12 Sierra with rbenv
View install-ruby-1.8.7.sh
#!/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
View 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
View 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
View decorators_poro.rb
class Poet
def produce_art(inspiration)
"#{inspiration} !"
end
end
class ArtistDecorator < Struct.new(:artist)
def produce_art(inspiration)
artist.produce_art(inspiration)
end
View 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'>
View scope_on_create.rb
# 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:
View BP-FatModelSkinnyController.rb
# 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?
View blogroll_horaextra.html
<!--
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>
You can’t perform that action at this time.