Skip to content

Instantly share code, notes, and snippets.

View dantoncancella's full-sized avatar

Danton Dietze Cancella dantoncancella

View GitHub Profile
@dantoncancella
dantoncancella / gist:4564350
Created January 18, 2013 12:47
Converting the data base return to csv form(for excel)
<?php
/*
* $result should be the return of a function of line "fetch_assoc", returned of a query on the data base
*/
if(!empty($result)) {
$filename = date('Ymd').'.csv';
@dantoncancella
dantoncancella / gist:4564370
Created January 18, 2013 12:52
jQuery 'limit' plugin for textarea
(function ($) {
$.fn.limit = function (options) {
var defaults = {
limit : 200,
result : false,
alertClass : false
}, options = $.extend(defaults, options);
return this.each(function () {
var characters = options.limit;
@dantoncancella
dantoncancella / gist:4564371
Created January 18, 2013 12:53
Default Character Set on MySQL command line import
mysql -u user -p database -h mysql.example.com --default-character-set=utf8 < import.sql
@dantoncancella
dantoncancella / gist:4564377
Created January 18, 2013 12:53
Default Vhost
<VirtualHost *:80>
ServerName example.local
DocumentRoot /path/to/example/public
SetEnv APPLICATION_ENV "development"
<Directory /path/to/example/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
@dantoncancella
dantoncancella / gist:4564382
Created January 18, 2013 12:54
jQuery 'plugin' dor defaultvalue of an input
(function($) {
$.fn.defaultValue = function() {
$(this).each(function(i, el) {
var actualValue,
$el = $(this),
defaultValue = el.value;
$el.on('focus', function() {
actualValue = $el.val();
@dantoncancella
dantoncancella / gist:4564386
Created January 18, 2013 12:54
jQuery 'plugin' to reset a form
(function($){
$.fn.reset = function () {
$(this).each (function() {
this.reset();
});
}
})(jQuery);
@dantoncancella
dantoncancella / gist:4564391
Created January 18, 2013 12:55
svn export alternative to git
git checkout-index -a -f --prefix=/path/to/your/folder/
# The ending forward slash is very important!
@dantoncancella
dantoncancella / Remove all SVN folders recursively from a folder
Last active December 11, 2015 07:09
Remove all SVN folders recursively from a folder
find . -name ".svn" -exec rm -rf {} \;
@dantoncancella
dantoncancella / Configure Gmail SMTP with Zend Framework
Last active September 27, 2020 08:42
Configure Gmail SMTP with Zend Framework
<?php
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'myusername@mydomain.com',
'password' => 'myPassword'
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
@dantoncancella
dantoncancella / PHP var_dump snippets on NetBeans
Last active December 11, 2015 07:09
PHP var_dump snippets
// PHP var_dump snipper for NetBeans
echo '<pre>';
die(var_dump(${VARIABLE variableFromPreviousAssignment default="$variable"}));