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 |
View index.html
<a id="download" href="#"><span class="entypo-install"></span>Download kaxi<span id="version">min. 2kb</span></a> |
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> |
View clearfix.styl
clearfix() | |
&:after | |
content "" | |
display table | |
clear both |
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 |
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 } | |
]; |
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} | |
} |
View from-querystring-to-object.js
// get the querystring from document object | |
const qs = document.location.search | |
// create searchParams object | |
const searchParams = new URLSearchParams(qs) | |
// create a plain object using entries | |
const queryParamsObject = Object.fromEntries(searchParams.entries()) | |
console.log(queryParamsObject) |
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 |