This file contains hidden or 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
Reserved Words: | |
ADDITIONAL_LOAD_PATHS | |
ARGF | |
ARGV | |
ActionController | |
ActionView | |
ActiveRecord | |
ArgumentError | |
Array |
This file contains hidden or 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
- save | |
- valid | |
before_validation | |
- validate | |
after_validation | |
before_save | |
before_create | |
- create | |
after_create | |
after_save |
This file contains hidden or 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
:binary # blob | |
:boolean # tinyint | |
:date # date | |
:datetime # datetime | |
:decimal # decimal | |
:float # float | |
:decimal # decimal | |
:integer # int(11) | |
:string # varchar(255) | |
:text # text |
This file contains hidden or 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
## CONSOLE | |
# Routes for a controller | |
rake routes CONTROLLER=products | |
## CONTROLLER | |
# Redirect to referrer | |
redirect_to :back # raise RedirectBackError if no referer | |
# Before filter and after filter in a same method |
This file contains hidden or 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
private int _twoDigitsYear(int year) { | |
if (year > 0) | |
year = year % 100; | |
return year; | |
} |
This file contains hidden or 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
# At 9, 13, 16 and 19 hour every monday, tuesday, wednesday, thursday and friday | |
* 9,13,16,19 * * 1,2,3,4,5 root /Applications/XAMPP/xamppfiles/bin/mysqldump -u root --all-databases | gzip > /Users/pierrick/Documents/Backups/Sites/database_`date +"%m_%d_%Y_%H_%M"`.sql.gz |
This file contains hidden or 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 | |
/** | |
* | |
*/ | |
class sfValidatorBIC extends sfValidatorBase | |
{ | |
protected $validator; | |
protected $errors; | |
protected function configure($options = array(), $messages = array()) |
This file contains hidden or 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
# Symfony aliases | |
## Cache | |
alias sf_cache_clear="php app/console cache:clear" # Clears the cache | |
alias sf_cache_warmup="php app/console cache:warmup" # Warms up an empty cache | |
## Doctrine | |
alias sf_doctrine_="php app/console doctrine:cache:clear-metadata" # Clears all metadata cache for a entity manager | |
alias sf_doctrine_="php app/console doctrine:cache:clear-query" # Clears all query cache for a entity manager | |
alias sf_doctrine_="php app/console doctrine:cache:clear-result" # Clears result cache for a entity manager | |
alias sf_doctrine_="php app/console doctrine:database:create" # Creates the configured databases |
This file contains hidden or 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
public class GoogleCalendar { | |
private Context _context; | |
private GoogleCalendarCallback _callback; | |
public GoogleCalendar(Context c, GoogleCalendarCallback cb) { | |
_context = c; | |
_callback = cb; | |
} | |
public void add(final String title, final Long dateStart, final Long dateEnd, |
This file contains hidden or 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 generateRandomKey(size) | |
{ | |
var keyset = 'abcdefghijklmnopqrstuvwxyz0123456789'; | |
var randomKey = ''; | |
for (var i = 0; i < size; i++) | |
{ | |
var rnum = Math.floor(Math.random() * keyset.length); | |
randomKey += keyset.substring(rnum,rnum + 1); | |
} |