Skip to content

Instantly share code, notes, and snippets.

View antoniofrignani's full-sized avatar
👨‍💻

Antonio Frignani antoniofrignani

👨‍💻
View GitHub Profile
@antoniofrignani
antoniofrignani / Preferences.sublime-settings
Last active October 27, 2020 17:38
Sublime Text User Configuration
{
"ignored_packages" : [ "Vintage" ],
"color_scheme" : "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"theme" : "Material-Theme.sublime-theme",
"font_size" : 15,
"always_show_minimap_viewport" : true,
"bold_folder_labels" : true,
"font_options" : ["gray_antialias", "subpixel_antialias"], // On retina Mac & Windows
"indent_guide_options" : ["draw_normal", "draw_active"], // Highlight active indent
"line_padding_bottom" : 3,
<?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 / invokable.php
Created July 13, 2016 13:32
Invokable callables as parameters
<?php
class Invokable {
function __invoke(Callable $function, array $params = []) {
if (is_callable($function)) return (call_user_func_array($function, $params));
}
}
$return = new Invokable();
$canTrue = function() {
@antoniofrignani
antoniofrignani / cc-identifier.js
Last active August 29, 2015 14:16
Detect credit Card
function autodetectCC( num ) {
if ( /^5[1-5]/.test( num ) ) {
selectCC( "mcrd" );
}
else if ( /^4/.test( num ) ) {
selectCC( "visa" );
}
@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 / TODO Configuration for Sublime
Last active December 29, 2015 13:29
Add this to your User/Preferences.sublime-settings
"patterns":
{
"BUG": "@BUG[\\s]*?:+(?P<bug>.*)$",
"CHANGED": "@CHANGED[\\s]*?:+(?P<changed>\\S.*)$",
"FIXME": "@FIX ?ME[\\s]*?:+(?P<fixme>\\S.*)$",
"NOTE": "@NOTE[\\s]*?:+(?P<note>.*)$",
"TODO": "@TODO[\\s]*?:+(?P<todo>.*)$"
},
"todo":
@antoniofrignani
antoniofrignani / gist:6548956
Created September 13, 2013 10:21
All UIfaces images, up to date. To find them in the page source use ST2/3 and find this regexp: (?<=<img src=")(faces/_twitter/.*?.(jpg|png|gif))
http://uifaces.com/faces/_twitter/jacobseethaler_128.jpg
http://uifaces.com/faces/_twitter/garrettgee_128.jpg
http://uifaces.com/faces/_twitter/nckjrvs_128.jpg
http://uifaces.com/faces/_twitter/kirkouimet_128.jpg
http://uifaces.com/faces/_twitter/ShaunMoynihan_128.jpg
http://uifaces.com/faces/_twitter/VinThomas_128.jpg
http://uifaces.com/faces/_twitter/Mr_Stezz_128.jpg
http://uifaces.com/faces/_twitter/kolage_128.jpg
http://uifaces.com/faces/_twitter/jayman_128.jpg
http://uifaces.com/faces/_twitter/cameronmoll_128.jpg
.hexagon {
width: 120px;
height: 60px;
position: relative;
}
.hexagon, .hexagon:before, .hexagon:after {
background: red;
border-radius: 5px
}
.hexagon:before, .hexagon:after {
@antoniofrignani
antoniofrignani / font-fix.css
Created July 3, 2013 17:51
Fix Google Font Rendering issue for some font [DO NOT USE, IT'S A HACK]
p {
-webkit-transform: rotate3d(-1, -1, -1, 0.01deg);
}
@antoniofrignani
antoniofrignani / style.css
Created July 2, 2013 18:30
Over header multicolor bar, using pseudo element :before a <header>
header:before {
display: block;
content: '';
height: 5px;
background-image: -webkit-linear-gradient(right, #b145c7 9%,#7646d6 9%,#7646d6 18%,#4a5adb 18%,#4a5adb 27%,#4a78e4 27%,#4a78e4 36%,#3a9dcf 36%,#3a9dcf 45%,#38bf73 45%,#38bf73 54%,#80c83b 54%,#80c83b 63%,#cad839 63%,#cad839 72%,#e7ba37 72%,#e7ba37 81%,#e77337 81%,#e77337 90%,#e9411f 90%,#e9411f 100%,#b145c7 100%);
background-image: -moz-linear-gradient(right, #b145c7 9%,#7646d6 9%,#7646d6 18%,#4a5adb 18%,#4a5adb 27%,#4a78e4 27%,#4a78e4 36%,#3a9dcf 36%,#3a9dcf 45%,#38bf73 45%,#38bf73 54%,#80c83b 54%,#80c83b 63%,#cad839 63%,#cad839 72%,#e7ba37 72%,#e7ba37 81%,#e77337 81%,#e77337 90%,#e9411f 90%,#e9411f 100%,#b145c7 100%);
background-image: -o-linear-gradient(right, #b145c7 9%,#7646d6 9%,#7646d6 18%,#4a5adb 18%,#4a5adb 27%,#4a78e4 27%,#4a78e4 36%,#3a9dcf 36%,#3a9dcf 45%,#38bf73 45%,#38bf73 54%,#80c83b 54%,#80c83b 63%,#cad839 63%,#cad839 72%,#e7ba37 72%,#e7ba37 81%,#e77337 81%,#e77337 90%,#e9411f 90%,#e9411f 100%,#b145c7 100%);
background-image: line