Skip to content

Instantly share code, notes, and snippets.

Robert Fotino rfotino

Block or report user

Report or block rfotino

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
@rfotino
rfotino / obstacle-solution.js
Created Apr 1, 2016
A solution for the Obstacle level on Spaceship.codes.
View obstacle-solution.js
/**
* Turns your ship to the given angle. Returns true when it is within
* epsilon radians of the target angle and the angular velocity is zero.
*
* @param {Number} angle
* @param {Number} [epsilon] Defaults to 0.001
* @return {Boolean} True if the operation is complete
*/
var servo = function(angle, epsilon) {
// Set a default value for epsilon
@rfotino
rfotino / servo.js
Created Apr 1, 2016
A servo function for spaceship.codes.
View servo.js
/**
* Turns your ship to the given angle. Returns true when it is within
* epsilon radians of the target angle and the angular velocity is zero.
*
* @param {Number} angle
* @param {Number} [epsilon] Defaults to 0.001
* @return {Boolean} True if the operation is complete
*/
var servo = function(angle, epsilon) {
// Set a default value for epsilon
@rfotino
rfotino / centroid.py
Last active Aug 7, 2019
Calculates the centroid of a non-intersecting polygon.
View centroid.py
def get_centroid(poly):
"""Calculates the centroid of a non-intersecting polygon.
Args:
poly: a list of points, each of which is a list of the form [x, y].
Returns:
the centroid of the polygon in the form [x, y].
Raises:
ValueError: if poly has less than 3 points or the points are not
formatted correctly.
"""
You can’t perform that action at this time.