View RenderCount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import styled from 'styled-components' | |
export default function RenderCount() { | |
const renders = React.useRef(0) | |
return <Circle>{++renders.current}</Circle> | |
} | |
const size = 30 |
View gist:330f8c59b5fbfc9b140b10d948ce5263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ScrollLock { | |
constructor () { | |
this.pageBody = document.querySelector('.body'); | |
this.scrollY = 0; | |
} | |
saveScrollY = (num) => { | |
this.scrollY = num; | |
} |
View promise_example.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajaxRequest (url, cb) { | |
setTimeout(() => { | |
cb({ height: 1000, width: 500}); | |
}, 2000) | |
} | |
const p = new Promise((res, rej) => { | |
ajaxRequest('url', (data) => { | |
res(data); | |
}) |
View 0_reuse_code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View Flexbox-grid-extended
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disabling the linter on this for now. | |
// scss-lint:disable SelectorFormat | |
// NOTE: Inactive to avoid potential conflicts - We might use this later in the Consumer project rebuild | |
// .container-fluid, | |
// .container { | |
// margin-right: auto; | |
// margin-left: auto; | |
// } | |
// |
View makeObjectIterable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeObjectIterable (obj) { | |
obj[Symbol.iterator] = function *() { | |
let properties = Object.keys(this); | |
for (let p of properties) { | |
yield this[p]; | |
} | |
} | |
return obj; | |
} |
View preferences.sublime-settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"color_scheme": "Packages/Theme - Brogrammer/brogrammer.tmTheme", | |
"folder_exclude_patterns": | |
[ | |
".svn", | |
".git", | |
".hg", | |
"CVS", | |
"node_modules", | |
"dist" |
View Default (OSX).sublime-keymap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} }, | |
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} }, | |
{ "keys": ["ctrl+shift+a"], "command": "move_to", "args": {"to": "bol", "extend": true} }, | |
{ "keys": ["ctrl+k"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, | |
{ "keys": ["ctrl+j"], "command": "move", "args": {"by": "subwords", "forward": false} }, | |
{ "keys": ["ctrl+shift+j"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, | |
{ "keys": ["ctrl+shift+k"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, | |
{ "keys": ["super+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} }, | |
{ "keys": ["ctrl+super+p"], "command": "swap_line_up" }, |
View basic-responsive-images.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint browser: true, debug: true */ | |
'use strict'; | |
// EXAMPLE USAGE CALL: | |
// | |
// init({ | |
// baseUrl: 'data-img-desktop', // will be used as largest, AND default if no other responsive tags are used | |
// responsive: [ // Array of breakpoint objects | |
// { | |
// breakpoint: 1024, |
View simple-parallax-fade.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint browser: true */ | |
'use strict'; | |
var viewportWidth = window.innerWidth || document.body.clientWidth; | |
var parallaxRange = 130; // How far the background moves from its starting position | |
var backgroundImages = [].slice.call(document.querySelectorAll('.bannerlax .banner-image')); | |
var content = [].slice.call(document.querySelectorAll('.bannerlax .banner-heading')); | |
NewerOlder