JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
| .cursor { | |
| cursor: url("cursor.png") 0 0, pointer; /* Legacy */ | |
| cursor: url("cursor.svg") 0 0, pointer; /* FF */ | |
| cursor: -webkit-image-set(url("cursor.png") 1x, url("[email protected]") 2x) 0 0, pointer; /* Webkit */ | |
| } |
JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
| // Appdelegate, view did finish loading | |
| var win = NSApplication.sharedApplication().windows.first! | |
| win.titlebarAppearsTransparent = true | |
| win.movableByWindowBackground = true | |
| win.styleMask = win.styleMask | NSFullSizeContentViewWindowMask; | |
| win.title = "" |
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.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| body { | |
| margin: 0; | |
| padding: 0; | |
| background-color: #fff; | |
| background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAANUlEQVQ4jWM8c+bMfwY8wNjYmBGfPBM+SWLAqAGDwQDG///xJgOGs2fP4lUw8F4YNYAKBgAA2NYKfxDn4ZUAAAAASUVORK5CYII=); | |
| overflow: hidden; | |
| } |
| 'use strict' | |
| var React = require('react-native') | |
| var { | |
| View, | |
| StyleSheet, | |
| } = React | |
| var {StyleSheetRegistry} = StyleSheet |
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
| /** | |
| * VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units | |
| * | |
| * To overcome this, create media queries that target the width, height, and orientation of iOS devices. | |
| * It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing | |
| * the height of element `.foo` —which is a full width and height cover image. | |
| * | |
| * iOS Resolution Quick Reference: http://www.iosres.com/ | |
| */ | |
| var URL = "http://gabrielecirulli.github.io/2048/" | |
| var frame = NSMakeRect(0,0,340,480) | |
| var webView = [[WebView alloc] initWithFrame:frame] | |
| [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:URL]]] | |
| var mask = NSTitledWindowMask + NSClosableWindowMask + NSMiniaturizableWindowMask + NSResizableWindowMask + NSUtilityWindowMask; | |
| var window = [[NSPanel alloc] initWithContentRect:frame styleMask:mask backing:NSBackingStoreBuffered defer:true]; | |
| [[window contentView] addSubview:webView] | |
| [window makeKeyAndOrderFront:nil] |
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |