Skip to content

Instantly share code, notes, and snippets.

View vutran's full-sized avatar

Vu Tran vutran

View GitHub Profile
@vutran
vutran / what-forces-layout.md
Created February 14, 2019 19:37 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@vutran
vutran / monster.json
Last active April 18, 2018 06:55
monster_base.json
[
{
"monster_id": "aptonoth", // by english name
"name": {
"en": "Aptonoth",
"ja": "アプトノス"
},
},
{
"monster_id": "mernos",
@vutran
vutran / voice-commands.jsx
Created September 12, 2017 13:59
Omnibar - Voice Commands
import Omnibar from 'omnibar';
import { withVoice } from 'omnibar';
const VoiceOmnibar = withVoice(Omnibar);
class App extends React.Component {
render() {
return (
<VoiceOmnibar
extensions={[
@vutran
vutran / custom-filter-command.jsx
Created September 12, 2017 13:57
Omnibar - Custom Filters
import { command } from 'omnibar';
import GitHubSearchExtension from './GitHubSearchExtension';
const GHExtension = command(GitHubSearchExtension, 'gh');
class App extends React.Component {
render() {
return (
<Omnibar extensions={[GHExtension]} />
);
@vutran
vutran / custom-item-renderer.jsx
Created September 12, 2017 13:55
Omnibar - Custom Item Renderer
function ResultItem(props) {
return (
<div>
<a href={props.url}>{props.title}</a>
</div>
);
};
class App extends React.Component {
render() {
@vutran
vutran / custom-extensions.jsx
Last active September 12, 2017 14:07
Omnibar - Custom Extensions
import Omnibar from 'omnibar';
import EchoExtension from './EchoExtension';
import GitHubSearchExtension from './GitHubSearchExtension';
import NpmSearchExtension from './NpmSearchExtension';
class App extends React.Component {
render() {
return (
<Omnibar
extensions={[
@vutran
vutran / EchoExtension.jsx
Created September 12, 2017 13:50
Omnibar - EchoExtension
export default function EchoExtension(query) {
return [
{
title: query,
subtitle: query,
},
];
}
@vutran
vutran / basic.jsx
Last active September 12, 2017 14:08
Omnibar Demos
import Omnibar from 'omnibar';
import EchoExtension from './EchoExtension';
class App extends React.Component {
render() {
<Omnibar
placeholder="Enter an expression"
extensions={[EchoExtension]} />
}
}
@vutran
vutran / README.md
Created October 8, 2016 05:37 — forked from rjorgenson/README.md
My ZSH Theme

agnoster.zsh-theme

forked by rjorgenson

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
  • NVM
  • RVM

Keybase proof

I hereby claim:

  • I am vutran on github.
  • I am vutran (https://keybase.io/vutran) on keybase.
  • I have a public key ASB44jpd0MJ8LJSl0B6nrRTA0s-m3PhVNu9w4LRPiDhdFQo

To claim this, I am signing this object: