Skip to content

Instantly share code, notes, and snippets.

View yuanqing's full-sized avatar

Yuan Qing Lim yuanqing

View GitHub Profile
obj
len
arr
elem
opts
fn
acc

CSS

  • Don't nest if you're using SCSS or LESS, or at least don't nest too much
  • BEM all the things (or use some variant of BEM)
  • Never use an id for styling purposes
  • For JS-specific classes, use .js-foo
  • Use a .text class for paragraphs/running text
@yuanqing
yuanqing / loadscript.js
Last active September 13, 2015 03:42 — forked from esamattis/loadscript.js
/**
* Simple node.js style script loader for modern browsers
**/
function loadScript(src, cb) {
var script = document.createElement('script');
script.async = true;
script.src = src;
script.onerror = function() {
cb(new Error("Failed to load" + src));
@yuanqing
yuanqing / gist:8736cef5ca9c613f6eac
Last active September 14, 2015 16:30 — forked from fat/gist:3744369
all you probably really need
/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;
@yuanqing
yuanqing / README.md
Last active September 14, 2015 16:32 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
var Polyglot = require('node-polyglot');
var phrases = {
x: 'foo',
y: '%{smart_count} bar |||| %{smart_count} bars'
};
var p = new Polyglot({
locale: 'en',
phrases: phrases
functional
stateless
immutable
composable
flat
simple
data
serializable
$ node index.js
ternary, true x 84,415,848 ops/sec ±2.47% (78 runs sampled)
ternary, false x 73,646,719 ops/sec ±5.86% (73 runs sampled)
&& and ||, true x 78,748,665 ops/sec ±2.80% (72 runs sampled)
&& and ||, false x 80,837,863 ops/sec ±1.84% (81 runs sampled)
Fastest is ternary, true
tell application "System Events"
tell process "Figma"
set frontmost to true
click menu item "Run last plugin" of menu "Plugins" of menu bar 1
end tell
end tell