Skip to content

Instantly share code, notes, and snippets.

@goldensunliu
goldensunliu / gist:865469b6f5a43779eb2e
Created March 18, 2015 19:41
Game of life in Processing.js
// Game of Life
int sx, sy;
float density = 0.2;
int lifeSqureWidth = 3;
int[][][] world;
void populate() {
for (int i = 0; i < sx * sy * density; i++) {
.label
display inline
padding .2em .6em .3em
font-size 75%
font-weight bold
line-height 1
color label-color
text-align center
white-space nowrap
vertical-align baseline
@require 'label'
@require 'OrgWideTypography'
.MyComponent__Label
@extend .label
.MyFeatureLayout
@extend $OrgMarketingLayout
.header
const StyleSheetServer = {
async renderStatic(appRenderFunc) {
reset();
startBuffering();
const result = await appRenderFunc();
const cssContent = flushToString();
return {
result,
css: {
@goldensunliu
goldensunliu / font-sizes.styl
Last active May 12, 2016 17:43
a font size source with some global selectors
// Font size definitions
$font-size-smaller = 1rem
$font-size-small = 2rem
$font-size-base = 3rem
// Global font styles
@require 'font-size'
.page__title
font-size $font-size-base
.page__content
font-size $font-size-small
@goldensunliu
goldensunliu / UspsCode.js
Created June 13, 2016 14:05
USPS state code to state name conversion with a simple Javascript implementation, an array and a function.
const UspsCodesToStateName = {
'AL' : 'Alabama',
'AK' : 'Alaska',
'AZ' : 'Arizona',
'AR' : 'Arkansas',
'CA' : 'California',
'CO' : 'Colorado',
'CT' : 'Connecticut',
'DE' : 'Delaware',
'DC' : 'District of Columbia',
@h1-size: 36px;
@h2-size: 24px;
@h3-size: 18px;
@grey: #212121;
@lightgrey: #616161;
.h1 {
color: @grey;
font-size: @h1-size;
}
@import "./page";
@import "./font-sizes";
.page2_title {
&:extend(.page_title);
}
.log_out_cta {
&:extend(.copy);
}
@import "./font-sizes";
.page_title {
&:extend(.h1);
}
.page_cta {
&:extend(.h3);
}