Skip to content

Instantly share code, notes, and snippets.

View diogomoretti's full-sized avatar
🌎

Diogo Moretti diogomoretti

🌎
View GitHub Profile
http://delta.hoerradar.de/deltaradio-grunge-mp3-hq
http://90s90s.hoerradar.de/90s90s-grunge-mp3-hq
@diogomoretti
diogomoretti / useUpload.js
Created April 12, 2020 21:01
useUpload – Simple upload hook for React applications
import { useState } from 'react'
export default function useUpload () {
const [file, setFile] = useState('')
const [fileName, setFileName] = useState('')
const onChangeHandler = e => {
setFile(e.target.files[0])
setFileName(e.target.files[0].name)
}
@diogomoretti
diogomoretti / meetup-draw.js
Last active October 10, 2019 04:06
Meetup Draw
// Example: https://www.meetup.com/floripajs/events/265094805/attendees
document.querySelector('.attendees-list').querySelectorAll('li')[Math.floor(Math.random() * document.querySelector('.attendees-list').querySelectorAll('li').length) + 1].querySelector('h4').textContent
@diogomoretti
diogomoretti / mojave-font.md
Last active September 25, 2018 20:50
Fix MacOS Mojave font smooth
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
@diogomoretti
diogomoretti / clone.sh
Last active December 25, 2019 09:59
Clone repository without history
git clone --depth 1 git://github.com/example-user/example-repo.git
@diogomoretti
diogomoretti / gist:10869863
Created April 16, 2014 12:54
gitignore.sublime-snippet
<snippet>
<content><![CDATA[
# Useful `.gitignore` templates:
# - https://github.com/github/gitignore
# OSX taken from: https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
# ----------------------------------------------------------------------------------------------
._*
.AppleDouble
@diogomoretti
diogomoretti / fix.css
Created March 4, 2014 15:40
Fix problem "inline-block + transition" in Chrome
.element-with-problem {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
}
@diogomoretti
diogomoretti / fix-jump-owl-carousel.css
Created February 7, 2014 17:53
Fix jump Owl Carousel on Chrome/Safari
@diogomoretti
diogomoretti / gh-pages-as-subfolder.sh
Created February 5, 2014 00:53
"gh-pages" branch as subfolder in github
# Make your gitHub project.
mkdir project
cd project/
git init
echo "# Project README file" > README.markdown
git add .
git commit -m "Project README added"
git remote add origin git@github.com:johndoe/project.git
git push origin master
@diogomoretti
diogomoretti / fonts.styl
Last active November 20, 2019 06:37
Stylus mixin @font-face
// Fonts mixin
font-url(file)
return '../fonts/' + file
webfont(family, file, hack-chrome-windows = false, weight = 'normal')
@font-face
font-family family
src url(font-url(file + '.eot'))
src url(font-url(file + '.eot?#iefix')) format('embedded-opentype'),
url(font-url(file + '.woff')) format('woff'),