Skip to content

Instantly share code, notes, and snippets.

@masnun
masnun / annotations.php
Created August 12, 2012 15:54
Demonstration of Doctrine Annotation Reader
<?php
/**
*@Annotation
*/
class AnnotatedDescription
{
public $value;
public $type;
public $desc;
}
@jonatanfroes
jonatanfroes / MY_Form_validation.php
Created August 20, 2012 14:16
CodeIgniter My_Form_validation p/ validação de CPF e outros
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* MY_Form_validation Class
*
* Extends Form_Validation library
*
*/
class MY_Form_validation extends CI_Form_validation {
function __construct()
@brycemcd
brycemcd / ex_workflow.txt
Created August 27, 2012 15:03
deploying tags
# Yesterday's deploy tag:
20120801
# See what's been merged today, what's about to deploy:
# https://github.com/TheClymb/theclymb/compare/20120801...HEAD
# Tag the current release for deploy:
@sabithpocker
sabithpocker / something.md
Created September 2, 2012 05:26
Ember.js action helper and routing.

#Relevent parts to explain action, routes in Ember 1.0pre

##Action Helper The {{action}} helper registers an HTML element within a template for DOM event handling and forwards that interaction to the Application's router, the template's Ember.View instance, or supplied target option (see 'Specifiying a Target'). User interaction with that element will invoke the supplied action name on the appropriate target.

(Example without Router skipped, check helpers/action.js)

@igorescobar
igorescobar / phonemask.js
Created September 14, 2012 20:35
Mascara Javascript para os novos telefones de São Paulo
// using: https://github.com/igorescobar/jQuery-Mask-Plugin
// version: v0.5.0+
var SPphoneMask = function(phone, e, currentField, options){
return phone.match(/^(\(?11\)? ?9(5[0-9]|6[0-9]|7[01234569]|8[0-9]|9[0-9])[0-9]{1})/g) ? '(00) 00000-0000' : '(00) 0000-0000';
};
$(".sp_celphones").mask(SPphoneMask, {onKeyPress: function(phone, e, currentField, options){
$(currentField).mask(SPphoneMask(phone), options);
}});
@gintsmurans
gintsmurans / error_handler_helper.php
Created September 26, 2012 19:55
Turn php errors into exceptions; Codeigniter's implementation, but can be adapted for every other project.
<?php
# Error handler
function custom_error_handler($errno, $errstr, $errfile, $errline)
{
if (AppSettings::$env == 'dev')
{
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
else
@ziadoz
ziadoz / Version20121011141021.php
Created October 11, 2012 20:53
Doctrine DBAL and Migrations Example
<?php
/*
* /path/to/migrations/directory/Version20121011141021.php
*/
namespace ExampleMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version20121011141021 extends AbstractMigration
@solar
solar / install.sh
Created October 16, 2012 18:06
install mysqld with supervisord
#!/bin/sh
sudo groupadd mysql
sudo mkdir -p /var/mysqld
sudo useradd -r -g mysql -M -d /var/mysqld mysql
sudo chown mysql:mysql /var/mysqld
sudo yum -y install cmake bison gcc-c++
curl -sL http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz | tar zx
cd mysql-5.5.28/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/5.5.28 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_bin
@garex
garex / creadits to NESTOR URQUIZA
Created October 31, 2012 15:56
Mysql dump sort keys contraints
#!/usr/bin/gawk -f
#FUNCTIONS
function printRecords(array) {
if( array[0] != "" ) {
asort(array);
for( j = length(array); j >= 1 ; j-- ) {
lastChar = "";
if (j > 1) {
lastChar = ",";
}
@TBonnin
TBonnin / git-remove-branches
Last active May 27, 2023 14:44
Safely remove local fully merged branches
#!/bin/bash
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches