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
PVector[] vectors = {leftHand, rightHand, leftElbow, rightElbow, leftShoulder, rightShoulder}; | |
// returns m and b as 0 and 1 of an array respectively. | |
float[] fits = bestFit(vectors); | |
// this value is floating all over the place | |
float r2 = rsquare(vectors, fits[0], fits[1]); | |
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
# require basic libraries | |
source 'https://rubygems.org' | |
require 'rubygems' | |
require 'sinatra' | |
require 'data_mapper' | |
# require DataMapper adapter, in this case we'll use Postgres | |
require 'dm-postgres-adapter' | |
DataMapper.setup(:default, ENV['DATABASE_URL']) |
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
<html> | |
<head> | |
<script src="http://cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.js"></script> | |
<script> | |
function sketchProc(processing) { | |
// Override draw function, by default it will be called 60 times per second | |
// void draw() { ... } | |
processing.draw = function() { | |
// determine center and max clock arm length | |
var centerX = processing.width / 2, centerY = processing.height / 2; |
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
var request = require('request'); | |
var zlib = require('zlib'); | |
var url = "http://api.stackexchange.com/2.1/search?order=desc&sort=activity&intitle=backbone&site=stackoverflow"; | |
request({ | |
encoding: null, // this keeps the body as a buffer and not a string | |
url: url, | |
headers: { 'accept-encoding': 'gzip,deflate' } | |
}, function (err, res, body) { |
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
50.times do | |
%x(curl --data "vote=dog" http://www.therehasneverbeenanythinglikethis.com/vote) | |
sleep (2.0) | |
end |
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
var http = require('http'); | |
// Set up ecstatic to read from the root folder of this app. | |
var ecstatic = require('ecstatic')(__dirname); | |
var matchRoutes = function (req, res) { | |
console.log('Request: '+ req.method + ' ' + req.url) | |
// Match the main route "/" | |
if (req.url === "/" ) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
install_root = File.expand_path(File.dirname(__FILE__)) | |
if !ARGV[0] | |
puts "ERROR: You must supply the name of the app you want to create. Like this:" | |
puts "./new_sinatra_app my_app" | |
exit 1 |
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
class Point { | |
int year; | |
int population; | |
float rateOfChange; | |
Point(int _year, int _population){ | |
year = _year; | |
population = _population; | |
} |
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
# http://help.github.com/ignore-files/ | |
# git config --global core.excludesfile ~/.gitignore_global | |
# Ruby Config # | |
############### | |
.sass-cache/ | |
.bundle/ | |
# Compiled source # | |
################### |
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
{ | |
"name": "node-static-test", | |
"version": "0.0.1", | |
"engines": { | |
"node": "0.8.x" | |
}, | |
"dependencies" : { | |
"http": "latest", | |
"node-static": "latest" | |
} |
NewerOlder