Skip to content

Instantly share code, notes, and snippets.

View netojoaobatista's full-sized avatar
💭
GitHub is not Orkut.

João Batista Neto netojoaobatista

💭
GitHub is not Orkut.
View GitHub Profile
@netojoaobatista
netojoaobatista / test.php
Created June 30, 2012 14:51
Duas consultas que retornam 5 linhas cada é mais rápido que 1 consulta que retorna 500 linhas.
<?php
//Total de execuções
$limit = 1000;
//Conexão com a base, comum para os dois casos
$pdo = new PDO('mysql:host=127.0.0.1;dbname=test', 'user', 'pswd');
//matrizes para armazenagem dos tempos
$times1 = array();
$times2 = array();
@netojoaobatista
netojoaobatista / cart.xsd
Created July 5, 2012 13:10
XML Schema da operação carrinho da Akatus
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:akt="http://connect.akatus.com/" elementFormDefault="qualified"
targetNamespace="http://connect.akatus.com/">
<xsd:element name="carrinho">
<xsd:complexType>
<xsd:all>
<xsd:element name="recebedor" type="akt:Receiver" />
<xsd:element name="pagador" type="akt:Payer" />
@netojoaobatista
netojoaobatista / gist:3060512
Created July 6, 2012 14:35
Access modifier
public class Sample {
/**
* @param args
*/
public static void main(String[] args) {
Sample2 sample2 = new Sample2();
sample2.test();
Sample4 sample4 = new Sample4();
sample4.test();
@netojoaobatista
netojoaobatista / Sample.java
Created July 6, 2012 14:47
Accessing private member
public class Sample {
private final String privateMember = "value";
/**
* @param args
*/
public static void main(String[] args) {
final Sample sampleInstance = new Sample();
System.out.println(sampleInstance.privateMember);
@netojoaobatista
netojoaobatista / GetExpressCheckoutDetails.php
Created July 10, 2012 14:58
Envio e recebimento do campo Custom no PayPal Express Checkout
<?php
$nvp = array(
'METHOD' => 'GetExpressCheckoutDetails',
'VERSION' => '84',
'PWD' => 'PWD',
'USER' => 'USER',
'SIGNATURE' => 'SIGNATURE',
'TOKEN' => $_GET['TOKEN']
);
@netojoaobatista
netojoaobatista / icss2element.xsl
Created July 12, 2012 15:06
Convert inline CSS to a corresponding element
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes" method="xml" omit-xml-declaration="yes"
encoding="utf-8" />
<xsl:template match="*[contains(./@style,'font-weight:bold')]">
<xsl:element name="b">
<xsl:apply-templates />
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@netojoaobatista
netojoaobatista / sample.js
Created July 14, 2012 17:30
Object.create() sample
var sample = (function() {
var score = 0;
return Object.create({}, {
increment: {
enumerable: true, writable: false, configurable: false,
value: function() {
score++;
}
},
getScore: {
@netojoaobatista
netojoaobatista / gui.js
Created July 20, 2012 04:00
AbstractFactory em Javascript
/**
* Estrutura básica para definição de um widget de interface de usuário
* @constructor
*/
function Widget() {
}
/**
* Implementação besta de um input