Skip to content

Instantly share code, notes, and snippets.

Rick Waldron rwaldron

Block or report user

Report or block rwaldron

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
View core.cljs
(ns mc-map.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(enable-console-print!)
(def app-state (atom {:mapOptions #js {:center (google.maps.LatLng. -34.397 150.644)
:zoom 8}}))
(defn map-view [app owner]
View 4-esc-arduino.ino
#include <Servo.h>
//Create the 4 esc objects
Servo esc1;
Servo esc2;
Servo esc3;
Servo esc4;
//Esc pins
int escPin1 = 8;
View a.js
Servo.animateGroup({
cuePoints: [0.125, 0.5, 0.625, 1.0],
duration: 2000,
members: [
{ servo: lf.coxa, deg: [82, dir === "fwd" ? 130 : 82, 103, 103] },
{ servo: lf.femur, deg: [111, dir === "fwd" ? 0 : 111, 70, 70] },
{ servo: lf.tibia, deg: [103, 103, 77, 77] },
{ servo: lb.coxa, deg: [98, dir === "fwd" ? 98 : 130, 77, 77] },
{ servo: lb.femur, deg: [111, dir === "fwd" ? 111 : 0, 70, 70] },
{ servo: lb.tibia, deg: [103, 103, 77, 77] },
View biped-preset-controls.js
function move(positions, speed) {
joints.forEach(function(part, i) {
legs[part].to(positions[i], speed);
});
}
var inits = [
{ pin: 10, id: "rf", startAt: 91 },
{ pin: 11, id: "rk", startAt: 92 },
{ pin: 12, id: "rh", startAt: 98 },
View kinect-controlled-robot-arm.js
var five = require("../lib/johnny-five.js");
/**
* PVector is a slightly-ported version of
* Processing.js's PVector.
*/
var PVector = require("./pvector.js").PVector;
/**
* To run this program you must first install
* libusb and OpenNI... Good luck with that.
*
@rwaldron
rwaldron / string-trimmers.md
Created Apr 16, 2014
ES7 Proposal: String.prototype.trimLeft(), String.prototype.trimRight()
View string-trimmers.md

String.prototype.trimRight()

This function interprets a string value as a sequence of code points, as described in 6.1.4.

The following steps are taken:

  1. Let O be CheckObjectCoercible(this value).
  2. Let S be ToString(O).
  3. ReturnIfAbrupt(S).
  4. Let T be a String value that is a copy of S with trailing white space removed. The definition of white space is the union of WhiteSpace and )LineTerminator. When determining whether a Unicode code point is in Unicode general category “Zs”, code unit sequences are interpreted as UTF-16 encoded code point sequences as specified in 6.1.4.
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

View serialport.js
/*global chrome*/
var EventEmitter = require('./events.js').EventEmitter;
var util = require('./util.js');
function SerialPort(port, options) {
var self = this;
var id;
var bytesToRead = options.buffersize || 1;
View basic-gpio.sh
#!/bin/bash
# Initialize the port for output:
echo -n "3" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio3/direction
# Turn the on-board Led on:
echo "1" > /sys/class/gpio/gpio3/value
# Now turn it off:
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

You can’t perform that action at this time.