Skip to content

Instantly share code, notes, and snippets.

View GianlucaGuarini's full-sized avatar
🎸
Rocking the world with few lines of code

Gianluca Guarini GianlucaGuarini

🎸
Rocking the world with few lines of code
View GitHub Profile
@GianlucaGuarini
GianlucaGuarini / form.html
Created April 16, 2016 08:56
React angular2 templates translated to riot check also https://twitter.com/gianlucaguarini/status/720961715903578112
<my-form>
<form onsubmit={ onSubmit }>
<div class="form-group">
<label for="name">Name</label>
<input class="form-control" required name="name" id="name" onchange={ changeName }>
</div>
<button type="submit" disabled={ !isValid }>Submit</button>
</form>
</my-form>
@GianlucaGuarini
GianlucaGuarini / blur.js
Created December 15, 2015 14:06
Blurrify
javascript:void(function(){var b=document.body;b.style.filter='blur(30px)';b.style.webkitFilter='blur(30px)';b.style.oFilter='blur(30px)';b.style.msFilter='blur(30px)'}())
@GianlucaGuarini
GianlucaGuarini / supports-css.js
Last active December 3, 2015 15:03
my small modernizr
/**
* Check if any css property is supported
* @param { String } property - css property to test for example 'column-count'
* @param { String } value - check whether a value is to a css property is supported
* @returns { String|Array|Boolean } either only the property in camel case, or the property and its value
* 4 ex:
* supportCss('column-count') => 'MozColumnCount'
* supportCss('column-count', '2') => ['MozColumnCount', '2']
* supportCss('position', 'sticky') => ['position', '-webkit-sticky']
*/
@GianlucaGuarini
GianlucaGuarini / test2.tag
Last active November 27, 2015 22:44 — forked from madfriend/test2.tag
<my-tag>
<p>{ opts.msg }</p>
</my-tag>
var scrollTo = function(el) {
$('html, body').animate({
scrollTop: el instanceof $ ? el.offset().top : typeof el === 'number' ? el : $('#' + el).offset().top
})
}
@GianlucaGuarini
GianlucaGuarini / helpers.js
Created April 9, 2015 12:24
Some useful helpers
export default {
/**
* Similar it handles any kind of ajax request
* @param { string } url url to call
* @param { string } type ajax request type
* @return { promise }
*/
ajax(url, type = 'get') {
return new Promise((resolve, reject) => {
var request = new XMLHttpRequest()
String.prototype.template = function (object) {
// Andrea Giammarchi - WTFPL License
var
stringify = JSON.stringify,
re = /\$\{(.*?)\}/g,
evaluate = [],
i = 0,
m
;
while (m = re.exec(this)) {
@GianlucaGuarini
GianlucaGuarini / commit-msg
Last active March 17, 2021 23:08 — forked from remi/commit-msg
Commits typos checker hook
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@GianlucaGuarini
GianlucaGuarini / theme.css
Created September 20, 2014 16:00
Colorsublime css theme template
.%cssClass% .ace_gutter {
background: #e8e8e8;
color: #333;
}
.%cssClass% .ace_print-margin {
width: 1px;
background: %printMargin%;
}
@GianlucaGuarini
GianlucaGuarini / iPad-IOS7-landscape-fullscreen-hack.js
Last active April 7, 2017 21:18
Hack to solve the annoying iPad iOS7 landscape extra height issue on the fullscreen web applications http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
/*!
*
* Author: Gianluca Guarini
* Contact: gianluca.guarini@gmail.com
* Website: http://www.gianlucaguarini.com/
* Twitter: @gianlucaguarini
*
*
**/
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {