Skip to content

Instantly share code, notes, and snippets.

@bardouni
bardouni / gist:be8588be095e426e7ae99dcae6881f05
Last active July 6, 2017 19:40
Generate margin/padding helper classes
$unit: px
$points: 0,5,10
@each $abbrs, $s in (-i:!important, '':'')
@each $pabbr, $p in (m:margin, p:padding)
@each $size in $points
@each $abbr,$name in (t:-top, b:-bottom, l:-left, r:-right, a:'')
.#{$pabbr}#{$abbr}-#{$size}#{$abbrs}
#{$p}#{$name}: $size#{$unit} #{$s}
@each $abbr, $a1, $a2 in (v,top,bottom),(h,left,right)
@bardouni
bardouni / app.js
Created December 3, 2018 16:01
You can use this gift to easily create a toggle system.
function useToggle(event = 'click') {
let ref = React.useRef();
function close() {
// console.log('call close')
if(ref.current){
ref.current.style.display = "none";
}
document.removeEventListener(event, close);
@bardouni
bardouni / app.js
Created December 3, 2018 16:01
You can use this gift to easily create a toggle system using ( React Hooks )
function useToggle(event = 'click') {
let ref = React.useRef();
function close() {
// console.log('call close')
if(ref.current){
ref.current.style.display = "none";
}
document.removeEventListener(event, close);