Skip to content

Instantly share code, notes, and snippets.

Pablo Cantero phstc

Block or report user

Report or block phstc

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
@phstc
phstc / happy_oop.rb
Created Oct 26, 2010
Happy OOP examples using Ruby
View happy_oop.rb
#These Ruby OOP examples, are based on the Rails 3 presentation by @guilhermecaelum
class Person
#the attribute name is immutable
def initialize(name)
@name = name
end
def name
@name
end
end
@phstc
phstc / README.md
Last active May 20, 2019
Browse a GitHub pull request based on the branch name
View README.md
  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 / pageChangesNotifier.js
Created Dec 22, 2010
Use this Bookmarklet to start monitoring a page for changes. When a page change is detected you will receive an alert notifying the changes
View pageChangesNotifier.js
javascript:(function(){
/*@author Pablo Cantero - http://pablocantero.com/blog/2010/09/15/javascript-para-notificar-se-o-site-teve-alteracoes*/
var xmlHttp = getXMLHttpObj();
if(xmlHttp == null){
alert('Failed to load XMLHTTP');
return;
}
var actual = getPageContent(xmlHttp, window.location.href);
var intervalId = window.setInterval(function(){
var current = getPageContent(xmlHttp, window.location.href);
@phstc
phstc / create-users.ts
Last active Dec 19, 2018
aws-cdk script for provisioning users + s3 buckets
View create-users.ts
/*
For deploying it:
Install aws-cdk: https://github.com/awslabs/aws-cdk then
npm run build
cdk deploy
*/
import cdk = require('@aws-cdk/cdk')
View notify-site-is-down.rb
# /usr/bin/notify-site-is-down.rb
require "rubygems"
require "twilio-ruby"
account_sid = ENV["TWILIO_ACCOUNT_SID"]
auth_token = ENV["TWILIO_AUTH_TOKEN"]
@client = Twilio::REST::Client.new account_sid, auth_token
@phstc
phstc / test_mijoes.html
Created Feb 15, 2011
Coding Dojo de Python no Google SP 10/02/2011 / Versão em Javascript.
View test_mijoes.html
<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.
View osx-for-hackers.sh
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
View app
# /etc/nginx/sites-available/app
upstream app_server {
server unix:/tmp/.unicorn_app.sock fail_timeout=0;
}
server {
listen 80;
server_name app.com;
View Rakefile
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 Jan 2, 2016
influxdb 0.4.0.rc5.src
View influxdb.sh
######### 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
You can’t perform that action at this time.