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: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: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: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: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: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: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';