Skip to content

Instantly share code, notes, and snippets.

View lunks's full-sized avatar

Pedro Nascimento lunks

View GitHub Profile
<?php
include "class-db.php";
include "data.class.php";
//Lista os aniversariantes, de hoje a ate daqui a 30 dias.
// Configure as informacoes pertinentes ao banco:
$database = "pina";
$servidor = "localhost";
$user = "root";
$pass = "";
<?php
/**
* Description of data.class
*
* @author Pedro
*/
class Data {
function b($date){
return implode("-", array_reverse(explode("/", $date)));
<?php
/**
* @author Jonathan Gotti <jgotti at jgotti dot org>
* @copyleft (l) 2003-2008 Jonathan Gotti
* @package DB
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @subpackage MYSQL
* @since 2004-11-26 first splitted version
* @changelog - 2008-04-06 - autoconnect is now a static property
* - 2008-03-20 - new static parameter (bool) $useNewLink used as mysql_connect new_link parameter
<?php
/**
* Base class for databases object.
* @author Jonathan Gotti <jgotti at jgotti dot org>
* @copyleft (l) 2003-2008 Jonathan Gotti
* @package DB
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @since 2006-04-16 first splitted version
* get_field and list_fields have changed -> list_table_fields (list_fields indexed by name)
* smart '?' on conditions strings
# Converting to binary, hexadecimal, ASCII, etc.
number = 100
base = 2
# syntax:
numero.to_s(base)
# => "1100100"
number.to_s(16)
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*
@lunks
lunks / metrics.rb
Created March 10, 2011 18:59
Metrical config
# .metrics
MetricFu::Configuration.run do |config|
config.metrics -= [:rcov, :rails_best_practices]
config.flog = {:dirs_to_flog => ['spec', 'lib']}
config.reek = {:dirs_to_reek => ['spec', 'lib']}
config.roodi = {:dirs_to_roodi => ['spec', 'lib']}
end
@lunks
lunks / gist:953763
Created May 3, 2011 17:24
i18n issue
class Order < ActiveRecord::Base
has_many :order_items
validates_length_of :order_items, :minimum => 1, :message => :empty
accepts_nested_attributes_for :order_items
end
#en.yml
activerecord:
module ApplicationHelper
ActionView::Base.default_form_builder = CustomFormBuilder
end
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-style-type" content="text/css"/>
<meta http-equiv="content-script-type" content="text/javascript"/>
<meta content="authenticity_token" name="csrf-param" />
<meta content="fepbL0PIBAyt/d7sYzW+muOhGse/+bvoF1QPXRAjIFY=" name="csrf-token" />