Skip to content

Instantly share code, notes, and snippets.

View samuelsimoes's full-sized avatar

Samuel Simões samuelsimoes

  • Appolus
  • Rio de Janeiro
View GitHub Profile
/Users/samuelsimoes/code/*/log/*.log {
missingok
rotate 0
size 3M
create
}
jQuery(function ($) {
var dispatcher = $({});
var Cart = {
init: function () {
var that = this;
this.dispatcher.on("shipping-value-calculated", function (event, shippingValue) {
that.sumShippingValue();
});

Capybara

save_and_open_page

Matchers

have_button(locator)
@samuelsimoes
samuelsimoes / rails_pessenger.md
Last active October 24, 2016 13:21
Rails app setup with Passenger using .htaccess only.

###/public_html/< root_of_app >/.htaccess

RewriteEngine On
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.*) public/$1

###/public_html/< root_of_app >/public/.htaccess

PassengerEnabled on
@samuelsimoes
samuelsimoes / using_garp_gem.md
Last active December 14, 2015 22:49
Using Garp gem with stored tokens from OAuth2

##Using Garp gem with stored tokens from OAuth2

You can easily get tokens using omniauth-google-oauth2 gem. Store token, refresh_token and expires_at from auth hash.

Case you don't have any credentials get this in Google Api Console.

Important: you need grant access to Analytics in your scope settings of ominauth gem and in Google API Console in "Services Tab" in order to use Garp gem.

module Reports
@samuelsimoes
samuelsimoes / .gitignore
Created February 27, 2013 23:06
.gitignore for workflow with Magento themes and modules. Wasn't beautiful, but is very useful and smart.
# --------------------------------------------------
# Ignoring all files of Magento
# --------------------------------------------------
/*
!/app/
/app/*
# --------------------------------------------------
# Not ignore your theme
# --------------------------------------------------
@samuelsimoes
samuelsimoes / ruby_provision.pp
Last active December 10, 2015 10:59
Simples manifesto para iniciar um ambiente Ruby, ainda faltam algumas coisas.
exec { "apt-get update":
command => 'sudo apt-get update',
path => '/usr/bin/'
}
class utils {
$utils = ["curl", "git-core", "python-software-properties", "build-essential",
"openssl", "libreadline6", "libreadline6-dev", "curl", "zlib1g", "zlib1g-dev",
"libssl-dev", "libyaml-dev", "libsqlite3-dev", "sqlite3", "libxml2-dev",
"libxslt-dev", "autoconf", "libc6-dev", "ncurses-dev", "automake", "libtool",
@samuelsimoes
samuelsimoes / gist:4112574
Created November 19, 2012 18:31
Wordpress Metabox Class
<?php
/**
* Classe para criar Metaboxes mais manuteníveis no Wordpress.
*
* PHP versions 5.3+
*/
class Metabox
{
public function __construct($key, $title, $screen, $callback=null)
{
@samuelsimoes
samuelsimoes / gist:4019669
Created November 5, 2012 19:11
Dicas Pagseguro

#Pagseguro, dicas…

Baseado nas minhas experiências com o PagSeguro deixo algumas dicas para quem tá começando com o PagSeguro.

Antes de tudo grave bem esses dois nomes:

  • Código de Notificação: código que identifica uma notificação, este código precisa ser "traduzido" pelo WebService para lhe trazer as informações da transação em questão (incluindo o código de referência).

  • Código de Referência: identificador de uma transação no PagSeguro anexado a uma transação no seu app.

@samuelsimoes
samuelsimoes / gist:3915540
Created October 19, 2012 00:15
Adaptando o CSS da paginação do Twitter Bootstrap para o CakePHP

###Adaptando o CSS da paginação do Twitter Bootstrap para o CakePHP Marcação necessária:

<div class="pagination">
  <div class="list">
    <?php
      echo $this->Paginator->prev('« Anterior', null, null, array('class' => 'prev disabled'));
      echo $this->Paginator->numbers(array('separator' => false));
      echo $this->Paginator->next('Próximo »', null, null, array('class' => 'prev disabled'));
    ?>