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
//** Dependencies **//
const path = require('path');
const webpack = require('webpack');
//** Options **//
const paths = require('./paths.js').paths;
const envUtil = require('../util/env');
<cool>
<p>Hi { message() }</p>
<script>
message() {
return 'there'
}
</script>
<style type="postcss" scoped>
<bar>
<p>bar</p>
</bar>
@GianlucaGuarini
GianlucaGuarini / promisify-everything.js
Last active July 25, 2016 06:19
Simple script to promisify the API of any javascript Object - It's an experiment don't use it in production!!!!
Object.defineProperty(Object.prototype, 'promise', {
get: function() {
return new Proxy({}, {
get: (target, name) => {
return new Promise((resolve) => {
this[name] = resolve
})
}
})
},
@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
})
}