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
<?php
//na parte de interface de usuário, faça com que o value
//contenha apenas o valor numérico do mês
echo '<select name="parametro">';
foreach (range(1, 12) as $month) {
printf('<option value="%d">%02d</option>', $month, $month);
}
echo '</select>';
@netojoaobatista
netojoaobatista / Customer.php
Created July 16, 2013 15:47
Fetching entities
<?php
namespace Example;
class Customer
{
private $id;
private $firstName;
private $lastName;
private $email;
private $company;
@netojoaobatista
netojoaobatista / mask.php
Created July 15, 2013 19:48
Mask with sscanf and vsprintf
<?php
function mask($input, $input_pattern, $output_pattern)
{
return vsprintf($output_pattern, sscanf($input, $input_pattern));
}
<?php
require 'php-captcha.inc.php';
# // define fonts
$fonts = '/home/guga/public_html/232classificados/captcha/fonts/';
$aFonts = array(
$fonts . 'VeraBd.ttf',
$fonts . 'VeraIt.ttf',
$fonts . 'Vera.ttf'
);
array(2) {
'começa com "de"' =>
array(3) {
[0] =>
string(7) "destino"
[1] =>
string(9) "delimitar"
[2] =>
string(7) "debugar"
}
#!/bin/bash
ICONV="iconv -f UTF-8 -t ISO-8859-1"
find $1 -type f -iname "*.html" | while read fn; do
cp ${fn} ${fn}.utf8
$ICONV < ${fn}.utf8 > ${fn}
rm ${fn}.utf8
done
<?php
interface Contract {
public function range($a, $b) {
pre {$a and $b must be an integer}
pos {$return must be greater than or equals $a AND less than $b}
}
}
package example;
public class Something {
public int sum(int a, int b) {
return a + b;
}
public double sum(double x, double y) {
return x + y;
}
@netojoaobatista
netojoaobatista / Test.js
Created May 15, 2013 20:59
JavaScript ToString
function Test(value) {
this.value = value;
}
Test.prototype.toString = function() {
return 'The value is ' + this.value;
};
var t = new Test(10);
NameVirtualHost 127.0.0.2:80
<Directory "/var/www/html/example/">
Options -Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost 127.0.0.2:80>