Skip to content

Instantly share code, notes, and snippets.

View dantoncancella's full-sized avatar

Danton Dietze Cancella dantoncancella

View GitHub Profile
@dantoncancella
dantoncancella / Installing Sublime Text 2 on Fedora (yum)
Last active February 5, 2019 22:54
Installing Sublime Text 2 on Fedora (yum)
# Add repository
yum-config-manager --add-repo http://repo.cloudhike.com/sublime2/fedora/sublime2.repo
# Enable repository
yum-config-manager --enable
# Installin Sublime Text 2
yum install sublime-text
#Tested on Fedora 17, 18
@dantoncancella
dantoncancella / Grant permissions for httpd service for Red Hat
Last active December 11, 2015 21:58
Grant permissions for httpd service for Red Hat
sudo chcon -R -t httpd_sys_content_rw_t 'thisfolfer'
@dantoncancella
dantoncancella / onverting the data base return to csv form(for excel)
Created January 23, 2013 15:51
onverting 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 / Cloning a git repo
Last active December 11, 2015 07:19
Create a git repository DreamHost
# Clone from the remote repository
[other ~]$ git clone ssh://[user@]host/~/project.git
@dantoncancella
dantoncancella / Formating brazilian date to english date on PHP-Js
Last active December 11, 2015 07:09
Formating brazilian date to english date
// After process, execute the PHP
$aux_date = implode("-", array_reverse(explode("/", date('d/m/Y'))));
// Or the JS
var aux_date = $('.date').val().split('/').reverse().join('-');
@dantoncancella
dantoncancella / make slug (PHP)
Last active December 11, 2015 07:09
make slug (PHP)
public function MakeSlug($str) {
$str = htmlentities($str, ENT_COMPAT, 'UTF-8');
$str = preg_replace('/&([a-zA-Z])(uml|acute|cedil|grave|circ|tilde);/', '$1', $str);
$str = preg_replace('/[^a-zA-Z]/', '-', strtolower($str));
$str = substr($str, -1) == '-' ? str_replace('--', '-', substr($str, 0,-1)) : str_replace('--', '-', $str);
return html_entity_decode($str);
}
@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"}));
@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' => '[email protected]',
'password' => 'myPassword'
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
@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 / 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!