Skip to content

Instantly share code, notes, and snippets.

View antoniofrignani's full-sized avatar
👨‍💻

Antonio Frignani antoniofrignani

👨‍💻
View GitHub Profile
<?php
/**
* PHP Regex to validate a Twitter hashtag
*
* Useful for validating a text input (an HTML form in your CMS or custom application) that must be a valid Twitter hashtag.
* Valid examples: #a, #_, #_1, #_a, #1a, #áéìôü, #123hàsh_täg446
* Invalid examples: #1, ##hashtag, #hash-tag, #hash.tag, #hash tag, #hashtag!, (any hashtag that is more than 140 characters long, hash symbol included)
*
* Regex explanation:
* First, the lookahead assertion (?=.{2,140}$) checks the minimum and max length, as explained here http://stackoverflow.com/a/4223213/1441613
@antoniofrignani
antoniofrignani / Default (OSX).sublime-keymap -- User
Last active August 29, 2015 14:05 — forked from coldnebo/Default (OSX).sublime-keymap -- User
Keymap to simulate home/end keyboard keys functionality on OSX as if it was Windows. Also includes ctrl and shift behaviors.
[
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } },
{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof"} },
{ "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof"} },
{ "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} },
{ "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} }
]
@antoniofrignani
antoniofrignani / dabblet.css
Created September 27, 2012 08:41 — forked from LeaVerou/dabblet.css
Links with arrow background
/**
* Links
*/
body {
background: #FFDEDB;
}
a {
display: inline-block;
@antoniofrignani
antoniofrignani / snippet.xml
Created September 13, 2012 21:44 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@antoniofrignani
antoniofrignani / bootstrap-grid.css
Created July 12, 2012 15:25 — forked from abitgone/bootstrap-grid.css
[BOOTSTRAP] Grid Overlay for Twitter Bootstrap
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-gradient(linear, top left, bottom left, color-stop(0%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(
@antoniofrignani
antoniofrignani / base.php
Created June 22, 2012 11:44 — forked from purwandi/base.php
[LARAVEL] My Base Model for Laravel
<?php
/**
* Base Model
*
* @package Extends Model Laravel
* @version 1.0
* @author Purwandi <free6300@gmail.com>
* @link http://purwand.me
*/
class Base extends Eloquent{
@antoniofrignani
antoniofrignani / auth.php
Created June 22, 2012 11:29 — forked from mwesten/auth.php
[LARAVEL] Laravel 3 Auth Controller
<?php
class Auth_Controller extends Base_Controller {
public $restful = true;
public function __construct() {
$this->filter( 'before', 'guest' )->except( array( 'logout', 'validate' ) );
// Note: We may not always require CSRF on login for system based logins so ignore it here.
$this->filter( 'before', 'csrf' )->on( 'post' )->except( array( 'login' ) );
}
@antoniofrignani
antoniofrignani / gist:2972206
Created June 22, 2012 11:28
[LARAVEL] Compress filter for Laravel
<?php
/*
|--------------------------------------------------------------------------
| Compress output before sending it to the browser
|--------------------------------------------------------------------------
|
| Removes all tabs and line breaks from the content before sending it to
| the browser.
|
@antoniofrignani
antoniofrignani / gist:2361168
Created April 11, 2012 18:27
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Martin Bean" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
html, body {
height: 100%;