This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"users": [{ | |
"name": "Tim Cook", | |
"role": "CEO", | |
"ava": "😬" | |
}, { | |
"name": "Eddy Cue", | |
"role": "Internet Services", | |
"ava": "😄" | |
}, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
import './App.css' | |
class Button extends Component { | |
static get defaultProps() { | |
return {color: 'red'} | |
} | |
handleClick() { | |
this.props.onClick() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
// Variables and Constants | |
let x = 2 | |
const obj = { | |
a: 10, | |
b: 20, | |
c: 30 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.define = (prop, desc) -> | |
Object.defineProperty(this.prototype, prop, desc) | |
class Name | |
constructor: ({@first, @last}) -> | |
@define "full", | |
get: -> | |
return "#{@first} #{@last}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const percent = 0.12; | |
const startX = getCoordinatesForPercent(0)[0] | |
const startY = getCoordinatesForPercent(0)[1] | |
const endX = getCoordinatesForPercent(percent)[0] | |
const endY = getCoordinatesForPercent(percent)[1] | |
const largeArcFlag = percent > .5 ? 1 : 0 | |
const pathData = [ | |
`M ${startX} ${startY}`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example with classes building components. | |
# This stuff is a little fiddly to get set up, | |
# but once it's working it's great - you can just | |
# add new instances of the components, and each | |
# components holds references to all of its | |
# children. You can set defaults & states for each | |
# component separately. | |
# | |
# (try clicking on the post author, and then on each | |
# of the comments on a post) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scroll = new ScrollComponent | |
size: Screen.size | |
scrollHorizontal: false | |
layers = [] | |
for i in [0..10] | |
layer = new Layer | |
parent: scroll.content | |
height: 300, width: 750 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red = new Layer | |
x: 543 | |
width: 207 | |
height: 300 | |
backgroundColor: "rgba(255,102,102,1)" | |
layer = new Layer | |
height: 300 | |
image: Utils.randomImage() | |
backgroundColor: "grey" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
red = new Layer | |
x: 543 | |
width: 207 | |
height: 300 | |
backgroundColor: "rgba(255,102,102,1)" | |
layer = new Layer | |
height: 300 | |
image: Utils.randomImage() | |
backgroundColor: "grey" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = (Utils.domLoadJSONSync "https://randomuser.me/api/?gender=female&results=27").results | |
String.prototype.upperCase = -> @charAt(0).toUpperCase() + @slice(1) | |
for item, i in handle | |
avatar = item.picture.medium | |
first = item.name.first.upperCase() | |
last = item.name.last.upperCase() | |
name = "#{first} #{last}" |
NewerOlder