Skip to content

Instantly share code, notes, and snippets.

View bmentges's full-sized avatar

Bruno Carvalho bmentges

  • Mentges Informatica
  • Rio de Janeiro, RJ, Brazil
View GitHub Profile
@bmentges
bmentges / heroku-remote.md
Created August 30, 2020 19:56 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@bmentges
bmentges / PostgreSQL_index_naming.rst
Created March 13, 2018 15:51 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@bmentges
bmentges / ctags.setup
Created March 25, 2017 18:57 — forked from nazgob/ctags.setup
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@bmentges
bmentges / app.rb
Created December 1, 2011 16:41
unique calculation using redis
# http://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
@bmentges
bmentges / schema.xml
Created May 4, 2011 19:47 — forked from jeremy/schema.xml
Basecamp Solr schema
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="basecamp" version="1.3">
<types>
<!-- indexed/stored verbatim -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- binary data, base64 -->
@bmentges
bmentges / jsonp
Created November 10, 2009 17:11 — forked from malsup/jsonp
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
var t = 0, cb = s.url.match(/callback=(\w+)/)[1], cbFn = window[cb];
var $script = $('head script[src*='+cb+']');
if (!$script.length)
return; // same domain request
## System update #########################################################################
aptitude update
aptitude -y safe-upgrade
aptitude -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential \
wget ssl-cert autotools-dev fakeroot dh-make automake autoconf libtool \
help2man libicu38 libreadline5-dev libicu-dev libcurl4-openssl-dev git-core \
htop links curl screen vim ec2-api-tools lsb-base libxml2 libxml2-dev \
libxslt1.1 libxslt1-dev xfsprogs sun-java6-jdk erlang-nox logrotate \
python-simplejson whois dig