Skip to content

Instantly share code, notes, and snippets.

👾
Web technologies lover! ❤️

Miguel Ángel Durán midudev

👾
Web technologies lover! ❤️
Block or report user

Report or block midudev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@midudev
midudev / useLegacyState.js
Created Jun 17, 2019
quick'n'dirty state replacement that emulates the general behaviour of the old setState
View useLegacyState.js
// hook to emulate legacy state behaviour
const useLegacyState = (initialState = {}) => {
const [state, setState] = useState(initialState)
function setLegacyState (partialNewState) {
let newState = {...state}
if (typeof partialNewState === 'object' && partialNewState !== null) {
newState = {...newState, ...partialNewState}
}
@midudev
midudev / animations.sh
Last active Nov 8, 2018
Make your OSX great again
View animations.sh
# sh ./animations.sh
# set keyboard repeat rate to 0, so instant
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
# instant quick look animation
defaults write -g QLPanelAnimationDuration -float 0
# increase speed of animation when resizing window of Cocoa apps
@midudev
midudev / using_map_and_filter.js
Created Oct 7, 2016
Example about how to use reduce to map and filter an array with one iteration
View using_map_and_filter.js
const MULTIMEDIA_IMAGE_TYPE_ID = 12
const multimedias = [
{ mediumSizeUrl: 'dog.jpg', typeId: 2 },
{ mediumSizeUrl: 'panda.jpg', typeId: 12 },
{ mediumSizeUrl: 'koala.jpg', typeId: 12 },
{ mediumSizeUrl: 'trex.jpg', typeId: 5 },
{ mediumSizeUrl: 'ratilla.jpg', typeId: 12 }
];
@midudev
midudev / testing_feedparser_ES6.js
Last active Aug 19, 2018
Example of using feedparser (https://github.com/danmactough/node-feedparser) with ES6 on node.js >= 4.0.0
View testing_feedparser_ES6.js
'use strict'
const FeedParser = require('feedparser')
const request = require('request')
let req = request('https://github.com/danmactough.atom')
let parser = new FeedParser()
req.on('error', (err) => {
// handle request error
@midudev
midudev / 0_reuse_code.js
Created Oct 6, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@midudev
midudev / clearfix.styl
Last active Dec 20, 2015
Stylus mixin to do clearfix to an element.
View clearfix.styl
clearfix()
&:after
content ""
display table
clear both
@midudev
midudev / index.html
Created Jul 3, 2013
A CodePen by Miguel. Which keycode is? - Discover which keycode is the key pressed. A simple script with pure JS to now the keyCode of the keyDown.
View index.html
<body>
<a href="//miduga.es" title="Desarrollado por miduga para desarrolladores">Developed by miduga</a>
<div id="i">
Press a key<br/><span>And discover his keyCode to use it in your JavaScript projects.</span></div>
<div id="k"></div>
@midudev
midudev / index.html
Created Jun 3, 2013
A CodePen by Miguel. Download button v.2 with entypo icon
View index.html
<a id="download" href="#"><span class="entypo-install"></span>Download kaxi<span id="version">min. 2kb</span></a>
You can’t perform that action at this time.