Skip to content

Instantly share code, notes, and snippets.

View lucasmezencio's full-sized avatar
:bowtie:
Neeeeeeeeerd

Lucas Mezêncio lucasmezencio

:bowtie:
Neeeeeeeeerd
View GitHub Profile
@lucasmezencio
lucasmezencio / jQuery.limit.js
Last active May 3, 2018 22: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;
@lucasmezencio
lucasmezencio / gist:4132957
Created November 22, 2012 21:18
Default Character Set on MySQL command line import
mysql -u user -p database -h mysql.example.com --default-character-set=utf8 < import.sql
@lucasmezencio
lucasmezencio / vhost.conf
Created November 5, 2012 00:54
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
@lucasmezencio
lucasmezencio / BasicAuthControllerProvider.php
Created November 1, 2012 01:02 — forked from brtriver/BasicAuthControllerProvider.php
Simple Basic Auth Controller for Silex.
<?php
namespace Silex\Provider;
use Silex\Application;
use Silex\SilexEvents;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@lucasmezencio
lucasmezencio / app.php
Created October 30, 2012 11:47
Sending emails with Silex Bootstrap (http://github.com/lucasmezencio/silex-bootstrap) and Swiftmailer + Twig
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = require __DIR__.'/bootstrap.php';
$app->match('/contact/', function(Request $request) use ($app) {
if ('POST' == $request->getMethod()) {
$data = array(
@lucasmezencio
lucasmezencio / jQuery.defaultValue.js
Last active May 3, 2018 22:49
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();
@lucasmezencio
lucasmezencio / gist:3918194
Created October 19, 2012 13:20
Arduino to 16x2 LCD Panel Connections
+------------------+------------------------------------------------+
| LCD Pin | Connect to |
+------------------+------------------------------------------------+
| 1 (VSS) | GND Arduino pin * |
| 2 (VDD) | + 5v Arduino pin |
| 3 (contrast) | Resistor or potentiometer to GND Arduino pin * |
| 4 RS | Arduino pin 12 |
| 5 R/W | Arduino pin 11 |
| 6 Enable | Arduino pin 10 |
| 7 | No connection |
@lucasmezencio
lucasmezencio / commit_message.md
Last active April 14, 2023 16:50
Como escrever a mensagem de um commit / How to write a commit message

As mensagens dos commits devem servir para três importantes coisas:

  • Para acelerar o processo de revisão.
  • Para ajudar a escrever uma boa nota de lançamento.
  • Para ajudar os futuros mantenedores (que pode ser você), ou ajudar a descobrir porque uma mudança foi feita no código ou porque uma funcionalidade foi adicionada.

Escreva sua mensagem de commit desta forma:

@lucasmezencio
lucasmezencio / jQuery.reset.js
Last active October 10, 2015 04:48
jQuery 'plugin' to reset a form
;(function ($, window, document, undefined) {
var pluginName = 'reset';
function reset(element) {
this.element = element;
this._name = pluginName;
this.init();
}
reset.prototype = {
@lucasmezencio
lucasmezencio / gist:3621480
Created September 4, 2012 14:09
svn export alternative to git
git checkout-index -a -f --prefix=/path/to/your/folder/
# The ending forward slash is very important!