- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
# https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments | |
code --install-extension aaron-bond.better-comments | |
# https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager | |
code --install-extension alefragnani.project-manager | |
# https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client | |
code --install-extension bmewburn.vscode-intelephense-client | |
# https://marketplace.visualstudio.com/items?itemName=christian-kohler.npm-intellisense |
# problem: when presenting, I want to obscure | |
# my prompt to act like it's at root of file system | |
# and be very basic with no git info, etc. | |
# solution: this theme lets you set a ENV to the path | |
# of your presentation, which will help remove unneeded prompt | |
# features while in that path | |
# oh-my-zsh theme for presenting demos | |
# based off the default rubbyrussell theme |
#!/usr/bin/env xcrun swift -O | |
/* | |
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3 | |
-------------------- https://gist.github.com/cfdrake/973505 --------------------- | |
gen.swift implements a genetic algorithm that starts with a base | |
population of randomly generated strings, iterates over a certain number of | |
generations while implementing 'natural selection', and prints out the most fit | |
string. | |
The parameters of the simulation can be changed by modifying one of the many |
license: gpl-3.0 | |
height: 1060 |
Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.
This trifect works well if you think of things like so:
this.state
in react should instead live within stores. Stores can listen to other stores as well as to events being fired.2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
function numerical_int(dx, y_array) { | |
var maxy = Math.max.apply(null, y_array); | |
var dy_array = y_array.map(function(num) { | |
return Math.abs(maxy - num); | |
}); | |
var profile_integral = 0; | |
var n = dy_array.length; | |
for (i = 1; i < n; i++) { | |
var dy_init = dy_array[i - 1]; | |
var dy_end = dy_array[i]; |