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 / ItemQueryRqSoapImpl.java
Created Nov 17, 2010
QuickBooks Web Connector QWC implementation in Java
View ItemQueryRqSoapImpl.java
package com.cantero.quickbooks.ws;
import java.util.ArrayList;
import javax.jws.WebService;
/*
* http://developer.intuit.com/qbsdk-current/doc/pdf/qbwc_proguide.pdf
*/
@WebService(endpointInterface = "com.cantero.ws.client.QBWebConnectorSvcSoap")
@phstc
phstc / geokit_monkey_patch.rb
Created Nov 23, 2010
Geokit monkey patch to work with rails 3.0.3, ruby 1.9.2p0
View geokit_monkey_patch.rb
#Apply this monkey patch in your application.rb
#See: https://github.com/andre/geokit-gem/issues#issue/7
module Geokit
require 'uri'
module Geocoders
class Geocoder
def self.logger()
if Geokit::Geocoders::logger.nil?
Geokit::Geocoders::logger = Logger.new(STDOUT)
Geokit::Geocoders::logger.level=Logger::DEBUG
View newie.java
public interface Dao {}
public class JpaDao implements Dao {}
public class ProductService {
private Dao dao;
public ProductService(Dao dao){
this.dao = dao;
}
}
@phstc
phstc / isFollowing.js
Created Dec 17, 2010
isFollowing Bookmarklet – Who is following who?
View isFollowing.js
javascript:(function(){
/*@author Pablo Cantero - http://pablocantero.com/blog/2010/12/20/isfollowing-bookmarklet-who-is-following-who*/
var isFollowing = function(twitterScreenNameA, twitterScreenNameB){
jQuery.getJSON('http://twitter.com/statuses/followers.json?screen_name=' + twitterScreenNameA + '&callback=?', function(data){
for(var i = 0; i < data.length; i++){
if(data[i].screen_name === twitterScreenNameB.replace('@', '')){
alert(twitterScreenNameB + ' is following ' + twitterScreenNameA);
return;
}
}
@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);
View jquery.twitter-example.js
/*
@pablocantero
http://pablocantero.com
https://github.com/phstc/jquery-twitter/
*/
(function(){
/*
Customized callback to show an error message on the tweets's lookup
This callback is optional, the default error callback shows an alert(errorMessage)
View jquery.twitter-example.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="https://github.com/phstc/jquery-twitter/raw/master/src/jquery.twitter.js"></script>
<script>
/*
@pablocantero
http://pablocantero.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
View devise.pt-BR.yml
pt-BR:
errors:
messages:
not_found: 'não encontrado'
already_confirmed: 'já foi confirmado'
not_locked: 'não foi bloqueado'
not_saved:
one: '1 erro impediu que %{resource} fosse gravado:'
other: '%{count} erros impediram que %{resource} fosse gravado:'
You can’t perform that action at this time.