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 phys = require('phys'); | |
console.log(phys.mechanics.momentum(2, 3)); | |
console.log(phys.information.mechanics.momentum()); |
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
<script src="http://www.physjs.com/js/phys.min.js"></script> | |
<script> | |
console.log(phys.basic.changein(2, 3)); | |
console.log(phys.mechanics.momentum(2, 3)); | |
</script> |
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
// Gets Weather from the ForecastIO API and saves the JSON file | |
var set_weather = function() { | |
jquery.getJSON('https://api.forecast.io/forecast/'+ apiKeys.forecastIO + '/' + person.latitude + ',' + person.longitude, function(data) { | |
fs.writeJson('./files/weather' + datetime + '.json', data, function(err){ | |
if(err){ console.log(err);} | |
weather.time = datetime; | |
weather.summary = data.currently.summary; | |
weather.temperature = String(convert_fahrenheitTocelsius(String(data.currently.temperature))); | |
weather.file = true; | |
}); |
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 queryAPI = function() { | |
$.ajax({ | |
// URL of the API you want to access | |
url: 'https://housing.nyu.edu/api/nyuapirooms/RoomSpaceDescription/AH-002E1-1', | |
// When the data comes back | |
success: function(data) { | |
// Go through all the data | |
for(var eachval in data) { | |
// and print all of it out | |
console.log(data[eachval]["HallName"]); |
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
''' | |
Finds all the circles within your eye | |
''' | |
import cv2 | |
import cv2.cv as cv | |
import numpy as np | |
image = cv2.imread('eye-image.jpg') | |
cv2.imshow('main_image', image) |
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
import urllib2 | |
import simplejson | |
import urllib | |
import errno | |
import os | |
# Fixed | |
globalSearchURL = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=%s&start=%s" | |
fetch = urllib2.build_opener() |
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
// run using g++-mp-4.7 -fopenmp -std=c++11 openmp_example.cpp -o openmp_example | |
// on my mac. Not sure about everyone elses, but my g++ version doesn't have openp | |
// so I have to use that one | |
#include <iostream> | |
using namespace std; | |
#include <omp.h> | |
int main(int argc, char *argv[]) |
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
import numpy as np | |
import sklearn | |
from sklearn.tree import * | |
from sklearn.datasets import * | |
iris = load_iris() | |
X = iris.data | |
y = iris.target |
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
{ | |
"_id": "5466b5a438f0d87f029cd0d5", | |
"abstract": null, | |
"allText": "By KEN BELSONNOV. 14, 2014\n\nThere is no shortage of ways for fans to bet on sports, even though federal law forbids gambling on games in almost all states: Fantasy leagues, state-run lotteries and neighborhood bookies, as well as online offshore ones, will take a fan’s action.\nFor decades, professional sports leagues have steadfastly opposed gambling and backed the prohibition of betting on games because they claimed it would undermine their sports’ integrity and lead to questions about the honesty of players and referees.\nBut the leagues, eager for a slice of a multibillion-dollar moneymaker, have also tiptoed around their own opposition. N.F.L. teams have licensing deals with state lotteries and have pushed to establish a franchise in London, where betting shops are ubiquitous.\nMajor League Baseball, the N.B.A. and the N.H.L. all work with fantasy sports companies. This year, the Devils and the Philadelphia 76ers partnered w |
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
import csv | |
ebola = open('Ebola_frequencies.csv') | |
csv_ebola = csv.reader(ebola) | |
for i in csv_ebola: | |
# Basically csv_ebola contains an array of items | |
# The first index: i[0] is the word | |
# And the rest i[1] i[2] i[3] i[4] correspond to the dates | |
print 'Word', i[0], '2014-10-20', i[1], '2014-10-27', i[2], '2014-10-06', i[3], '2014-10-13', i[4] |
OlderNewer