This file contains hidden or 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
mongoose = require 'mongoose' | |
Model = mongoose.Model | |
Query = mongoose.Query | |
setHooks = (hooks) -> | |
modifyCallback = -> | |
args = Array.prototype.slice.call arguments | |
args.forEach (arg, index) -> | |
if typeof arg is 'function' |
This file contains hidden or 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 express = require('express') | |
, app = express() | |
app.get('*', function(req, res, next) { | |
res.sendfile(req.url.replace(/^\//, '')) | |
}) | |
app.listen(1337); |
This file contains hidden or 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
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
# NEW WAY / EASY WAY | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.deb | |
sudo dpkg -i elasticsearch-0.90.3.deb |
This file contains hidden or 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 five = require("johnny-five") | |
, board = new five.Board() | |
, leds = [2, 3, 4, 5, 6, 7, 8, 9] | |
board.on("ready", function() { | |
var led = new five.Led(6) | |
this.repl.inject({unlockDoor: unlockDoor.bind(this, led)}) | |
}) | |
function unlockDoor(led) { |
This file contains hidden or 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
{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "songs": [{"message": "query code length is too small", "error": "need co | |
des in query for fingerprint matching"}]}} |
This file contains hidden or 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
function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters) | |
%GRADIENTDESCENT Performs gradient descent to learn theta | |
% theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by | |
% taking num_iters gradient steps with learning rate alpha | |
% Initialize some useful values | |
m = length(y); % number of training examples | |
J_history = zeros(num_iters, 1); | |
for iter = 1:num_iters |
This file contains hidden or 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
function [X_norm, mu, sigma] = featureNormalize(X) | |
%FEATURENORMALIZE Normalizes the features in X | |
% FEATURENORMALIZE(X) returns a normalized version of X where | |
% the mean value of each feature is 0 and the standard deviation | |
% is 1. This is often a good preprocessing step to do when | |
% working with learning algorithms. | |
% You need to set these values correctly | |
X_norm = X; | |
mu = zeros(1, size(X, 2)); |
This file contains hidden or 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
function J = costFunctionJ(X, y, theta) | |
% X is the "design matrix" containg our training examples | |
% y is the class labels | |
m = size(X,1); % numbedr of training examples | |
predictions = X*theta; % predictions of hypothesis on all m examples | |
sqrErrors = (predictions - y) .^2; % squared errors | |
J= 1/(2*m) * sum(sqrErrors); |
This file contains hidden or 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
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
# Download the compiled elasticsearch rather than the source. | |
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /usr/local/share |
This file contains hidden or 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
/* |\ | |
.-""-._ \ \.--| | |
/ "-..__) .-' | |
ಠ_______ಠ / | |
\'-.__, .__.,' | |
`'----'._\--' | |
* Whale whale whale, what have we here? | |
* / |