Skip to content

Instantly share code, notes, and snippets.

View viniciussbs's full-sized avatar

Vinícius Sales viniciussbs

  • Rio de Janeiro, Brasil
View GitHub Profile
# Returns a copy of self with all +true+ elements removed.
# [ "a", true, "b", true, "c", true].compact_true #=> [ "a", "b", "c" ]
#
def compact_true
remove_elements(TrueClass)
end
# Returns a copy of self with all +false+ elements removed.
# [ "a", false, "b", false, "c", false].compact_true #=> ["a","b","c" ]
#
#!/usr/bin/env ruby
git_dir = '/home/i0n/git'
# git_dir = '/Users/i0n/sites/bin/'
app_name = ARGV
Dir.chdir git_dir
Dir.mkdir "#{app_name}.git"
Dir.chdir "#{git_dir}/#{app_name}.git"
system "git init --bare"
puts "SUCCESS!"
~ % ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10]
~ % rvm list
rvm rubies
ruby-1.9.2-p0 [ x86_64 ]
~ % rvm use 1.9.2@rails2
@cgallagher
cgallagher / milestone.rb
Created June 13, 2012 10:28
Active Admin Image Upload Form
ActiveAdmin.register Milestone do
scope :all, :default => true
scope :global
scope :user_specific
index do
column :title
column :description
column :required_litres
column :is_active
@viniciussbs
viniciussbs / dev.conf
Created November 5, 2012 20:21 — forked from fnando/dev.conf
Nginx configuration for SSH tunnel
upstream tunnel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name dev.codeplane.com br.dev.codeplane.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
@viniciussbs
viniciussbs / endpoints.md
Created December 10, 2015 20:13 — forked from derhuerst/_.md
List of HAFAS API Endpoints
@brandur
brandur / heroku-api-stub.md
Last active December 20, 2015 22:09
Engineering API-driven Applications Using Service Stubs

Engineering API-driven Applications Using Service Stubs

Developing applications against foreign services like the Heroku Platform API can unlock a powerful set of otherwise unavailable features, but can come with drawbacks: development must occur online, valid credentials are required, calls your code makes will reveal and manipulate real data, and API calls in tests have to stubbed out individually.

This article will offer a short overview on how these pain points can be

A proposal for a framework-agnostic way of building Javascript configuration objects based on different environments.

This proposal focuses on the conventions that will allow for the creation of a plain old JavaScript object. For example:

var environment = new Environment("development");
environment.name; // "development"
environment.config.API_ROOT; // "http://localhost:3000/"
@helfer
helfer / apollo-1-migration.md
Last active May 31, 2017 01:09
Migrating from Apollo Client 0.x to 1.0

Migrating from Apollo Client 0.x to 1.0

Here are the main breaking changes between the 0.x and 1.0 versions of Apollo Client.

fetchMore

The structure of fetchMoreResult has been changed. Previously fetchMoreResult used to contain data and loading fields, now fetchMoreResult is what fetchMoreResult.data used to be. This means your updateQueries function has to change as follows:

updateQuery: (prev, { fetchMoreResult }) => {
@vagnerzampieri
vagnerzampieri / .bash_aliases
Last active October 25, 2017 20:18
Alias público, se tiver coisas interessantes, contribua.
function mkcd(){
mkdir $1;
cd $1;
}
# Apt
alias apti='sudo apt-get install'
alias apts='sudo apt-cache search'
alias aptp='sudo apt-get --purge remove'
alias aptr='sudo apt-get remove'