Skip to content

Instantly share code, notes, and snippets.

@phstc
phstc / README.md
Last active May 20, 2019 13:15
Browse a GitHub pull request based on the branch name
  1. download gpr into ~/bin
  2. change org and repo in the script
  3. chmod +x ~/bin/gpr
  4. edit ~/.zshrc adding export PATH="$HOME/bin:$PATH"
  5. cd your-cloned-dir then gpr
@phstc
phstc / test_mijoes.html
Created February 15, 2011 18:49
Coding Dojo de Python no Google SP 10/02/2011 / Versão em Javascript.
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
<!--
Problema: Mijões
Objetivo dados X mictórios e Y mijões, retorne um array contendo VAZIO e MIJAO.
Sendo que os mijões devem ser alocados de forma mais distante possível.
# /etc/nginx/sites-available/app
upstream app_server {
server unix:/tmp/.unicorn_app.sock fail_timeout=0;
}
server {
listen 80;
server_name app.com;
require 'rubygems'
require 'rake'
require 'rake/testtask'
require File.expand_path('../lib/mongomapper_id2/version', __FILE__)
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/{functional,unit}/**/*_test.rb'
end
@phstc
phstc / influxdb.sh
Last active January 2, 2016 14:29
influxdb 0.4.0.rc5.src
######### install influxdb 0.4.0.rc5.src
$ brew uninstall influxdb
$ rm /usr/local/etc/influxdb.conf
$ rm -rf /usr/local/var/influxdb
$ brew update
$ brew install influxdb --devel
project_name: augury
project_root: /Users/pablo/workspace/augury
windows:
- servers:
layout: even-vertical
panes:
- foreman start
- cd /Users/pablo/workspace/augury_admin && rails s -p 4000
- cd /Users/pablo/workspace/spree-2-0-stable/sandbox && rails s
- cd /Users/pablo/workspace/persistence_endpoint shotgun config.ru -p 9292
# foreman start -f Procfile_augury
mongo: mongod
augury: sh -c 'cd /Users/pablo/workspace/augury && foreman start'
augury_admin: sh -c 'cd /Users/pablo/workspace/augury_admin && rails s -p 4000'
sandbox: sh -c 'cd /Users/pablo/workspace/spree-2-0-stable/sandbox && rails s'
spree_endpoint: sh -c 'cd /Users/pablo/workspace/spree_endpoint rails s -p 5000'
persistence_endpoint: sh -c 'cd /Users/pablo/workspace/persistence_endpoint shotgun config.ru -p 9292'
var payload = { parameters: [{ name: 'test', 'value': 'abc' }, { name: 'test2', value: 'def' }] };
function updateParameter(name, value){
payload['parameters'].forEach(function(parameter){
if(parameter['name'] === name){
parameter['value'] = value;
return false; // break
}
});
}
@phstc
phstc / gist:7733092
Created December 1, 2013 12:33 — forked from afeld/gist:5704079

TODO: make gem for this

This was tested using Rails 3.2 and Rails 4.0 on Ruby 2.0.0.

Bower

  1. Set the install directory for Bower components:

// .bowerrc

{
"name": "mandrill",
"display": "Mandrill",
"description": "Sends transactional emails using Mandrill",
"help": "http://guides.spreecommerce.com/integration/endpoints/mandrill",
"url": "http://mandrill-stg.spree.mx",
"category": "email",
"services": [
{
"name": "order_confirmation",