This file contains 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
int rectWidth = 100; | |
int rectHeight = 40; | |
float rectR, rectG, rectB; | |
float rectSpeedX, rectSpeedY; | |
float rectX, rectY; | |
void setup() { | |
size(500, 500); | |
changeColor(); | |
rectSpeedX = random(1, 10); |
This file contains 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 participants = require("./data.json"); | |
const isAware = (experience) => experience !== "never_heard"; | |
const isInterested = (experience) => | |
experience === "interested" || experience === "would_use"; | |
const numParticipantsMoreThan = (dictNumTechToNumParticipants, num) => Object | |
.keys(dictNumTechToNumParticipants) | |
.filter(n => n > num) | |
.reduce((acc, n) => acc + dictNumTechToNumParticipants[n], 0) |
This file contains 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
/* | |
* We define coordinate variables first. We define them | |
* here because we want them to be global. | |
*/ | |
int x1, y1; | |
int x2, y2; | |
int x3, y3; | |
int x4, y4; | |
/* |
This file contains 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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains 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
{ | |
on: 'login_submitted', | |
when: ({ event }) => isValid(event.email, event.password), | |
reaction: ({ event }) => broadcast('on_request', { | |
type: 'login', | |
path: '/api/login', | |
params: { ...event } | |
}), | |
reactionElse: () => alert('Invalid parameters'), | |
}, |
This file contains 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
{ | |
on: ..., // string or string[] | |
when: ..., // function or function[] or any | |
reducer: ..., // function or function[] | |
reducerElse: ..., // function or function[] | |
reaction: ..., // function or function[] | |
reactionElse: ..., // function or function[] | |
} |
This file contains 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
submitted() { | |
broadcast('login_submitted', { | |
email: this.state.email, | |
password: this.state.password | |
}) | |
} | |
<form onSubmit={this.submitted}> | |
... | |
{ this.props.loading.login && <div>Loading...</div> } |
This file contains 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
{ | |
on: 'on_request', | |
reducer: ({ state, event }) => ({ ...state, loading: { [event.type]: true } }), | |
reaction: ({ event }) => api(event.path, event.params) | |
.then(res) => broadcast('request_success', res) | |
.catch(err) => broadcast('request_fail', err) | |
.finally() => broadcast('request_resolved', event) | |
}, | |
{ | |
on: 'request_resolved', |
This file contains 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
Show hidden characters
[ | |
{ "keys": ["super+t"], "command": "reindent", "args": {"single_line": false}}, | |
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context": | |
[ | |
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" }, | |
{ "match_all": true, "key": "selection_empty" }, | |
{ "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" }, | |
{ "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" }, | |
{ "match_all": true, "key": "is_abbreviation" } | |
] |
This file contains 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
void setup() { | |
size(500, 500); | |
} | |
void draw() { | |
if (mousePressed) { | |
// Codes here will be executed as long as the mouse | |
// button is pressed | |
NewerOlder