Skip to content

Instantly share code, notes, and snippets.

Sitian Liu goldensunliu

Block or report user

Report or block goldensunliu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@goldensunliu
goldensunliu / gist:865469b6f5a43779eb2e
Created Mar 18, 2015
Game of life in Processing.js
View gist:865469b6f5a43779eb2e
// 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++) {
View label.styl
.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
View MyProductFeature.styl
@require 'label'
@require 'OrgWideTypography'
.MyComponent__Label
@extend .label
.MyFeatureLayout
@extend $OrgMarketingLayout
.header
View SSR.js
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
a font size source with some global selectors
View font-sizes.styl
// Font size definitions
$font-size-smaller = 1rem
$font-size-small = 2rem
$font-size-base = 3rem
// Global font styles
View page.styl
@require 'font-size'
.page__title
font-size $font-size-base
.page__content
font-size $font-size-small
@goldensunliu
goldensunliu / UspsCode.js
Created Jun 13, 2016
USPS state code to state name conversion with a simple Javascript implementation, an array and a function.
View UspsCode.js
const UspsCodesToStateName = {
'AL' : 'Alabama',
'AK' : 'Alaska',
'AZ' : 'Arizona',
'AR' : 'Arkansas',
'CA' : 'California',
'CO' : 'Colorado',
'CT' : 'Connecticut',
'DE' : 'Delaware',
'DC' : 'District of Columbia',
View font-sizes.less
@h1-size: 36px;
@h2-size: 24px;
@h3-size: 18px;
@grey: #212121;
@lightgrey: #616161;
.h1 {
color: @grey;
font-size: @h1-size;
}
View page2.less
@import "./page";
@import "./font-sizes";
.page2_title {
&:extend(.page_title);
}
.log_out_cta {
&:extend(.copy);
}
View page.less
@import "./font-sizes";
.page_title {
&:extend(.h1);
}
.page_cta {
&:extend(.h3);
}
You can’t perform that action at this time.