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
// Adding counter | |
db.counters.insert( | |
{ | |
_id: "userid", | |
seq: 0 | |
} | |
); | |
// function to add sequence | |
function getNextSequence(name) { |
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
DROP FUNCTION IF EXISTS `format_sku`; | |
DELIMITER // | |
CREATE FUNCTION `format_sku`(`str` TEXT) | |
RETURNS text | |
LANGUAGE SQL | |
DETERMINISTIC | |
NO SQL | |
SQL SECURITY INVOKER | |
COMMENT '' |
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
// Convert Mapping | |
./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Application\\Entity\\" --force --from-database annotation ./module/Application/src/ | |
// Add methods | |
./vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate-entities ./module/Application/src/ --generate-annotations=true |
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
register_shutdown_function( "fatal_handler" ); | |
function send_error($str = '') { | |
$Settings = array('auth' => 'login', | |
'ssl'=> 'ssl', | |
'port'=> '465', | |
'username' => 'username', | |
'password' => 'pass'); | |
$transport = new Zend_Mail_Transport_Smtp('smtp.email.com',$Settings); |
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 | |
function fibb($limit = 1, $first_number = 0, $second_number = 1) { | |
if ($limit <= 0) { | |
exit('End'); | |
} | |
echo $second_number."\n"; | |
fibb($limit-1, $second_number, ($first_number + $second_number)); | |
} |
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 | |
function send_error($str = '') { | |
if (getEnvironment() == 'production') { | |
$return = null; | |
// Configuração de dados SMTP, a gosto do programador | |
$Settings = array('auth' => 'login', | |
'ssl'=> 'ssl', | |
'port'=> '465', | |
'username' => '[email protected]', |
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
String.prototype.toSlug = function(){ | |
str = this.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "ãàáäâèéëêìíïîõòóöôùúüûñç·/_,:;"; | |
var to = "aaaaaeeeeiiiiooooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) { | |
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
} |
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
yum install php-pear | |
# Discovering all channels | |
pear channel-discover pear.phpunit.de | |
pear channel-discover pear.symfony-project.com | |
pear channel-discover components.ez.no | |
# Install PHPUnit with Yaml | |
pear install pear.symfony.com/Yaml | |
pear install --alldeps pear.phpunit.de/PHPUnit |
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 | |
if (!defined('BASE_PATH')) define('BASE_PATH', realpath(dirname(__FILE__))); // Root path folder to load classes | |
function autoloader($class_name) { | |
$class_name = ltrim($class_name, '\\'); | |
$file_name = ''; | |
$namespace = ''; | |
if ($lastNsPos = strrpos($class_name, '\\')) { | |
$namespace = substr($class_name, 0, $lastNsPos); | |
$class_name = substr($class_name, $lastNsPos + 1); |
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
Plugin: https://github.com/martomo/SublimeTextXdebug | |
Command: phpunit -d xdebug.profiler_enable=on -d xdebug.idekey=sublime.xdebug File.php | |
Configuration Xdebug: | |
xdebug.remote_enable = 1 | |
xdebug.remote_handler = dbgp | |
xdebug.remote_host = 127.0.0.1 | |
xdebug.remote_port = 9000 |
OlderNewer