This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function beforeSave(){ | |
$d = &$this->data[$this->alias]; | |
if ( !$this->id && !isset($d['id']) ) { | |
//check if we already have that phone register (would be an update) | |
$id = $this->field('id', array('phone' => $d['phone'])); | |
$this->id = $d['id'] = $id; | |
} | |
if(isset($d['phone'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modo de uso de emails | |
options = {} | |
gmail.emails(options) do |email| | |
# aqui tengo cada email.. | |
end | |
# Quiero crear un metodo llamado search que me llame emails de un modo particular, la idea es que esto funcione: | |
gmail.search('pepito moreno') do |email| | |
# aqui tendria cada email, igual que si hubiera llamado gmail.emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('AppModel', 'Model'); | |
/** | |
* Setting Model | |
* | |
*/ | |
class Setting extends AppModel { | |
/** | |
* Display field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config defaultToCurrentScreen true | |
config nudgePercentOf screenSize | |
config resizePercentOf screenSize | |
config secondsBetweenRepeat 0.1 | |
config checkDefaultsOnLoad true | |
config focusCheckWidthMax 3000 | |
config windowHintsDuration 5 | |
config windowHintsSpread true | |
config windowHintsOrder persist | |
config windowHintsShowIcons true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Sets Prezto options. | |
# | |
# Authors: | |
# Sorin Ionescu <sorin.ionescu@gmail.com> | |
# | |
# | |
# General | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cree estos directorios en donde tiene su app: | |
# docker | |
# mysql | |
# mysql_data (vacio) | |
# mysql_init | |
# initial.sql (puede estar en gz) o si quiere no existir, es la db por defecto | |
# php | |
# php-overrides.ini # cualquier configuracion del php.ini que quiera | |
# ejecutar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Validator | |
def self.included(klass) | |
klass.extend ClassMethods | |
end | |
module ClassMethods | |
def inherited(child_class) | |
child_class.instance_variable_set :@required_fields, self.required_fields | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This avoid Deadlock | |
module ActiveRecord | |
module ConnectionAdapters | |
class Transaction | |
def before_commit_records | |
return unless records && @run_commit_callbacks | |
records.uniq.sort_by(&DeadlockPreventionOrder).each(&:before_committed!) | |
end |
OlderNewer