Sum a dimension N square matrix main and anti diagonal values.
Given the Matrix:
[ [ 1, 2, 3, 4]
, [ 5, 6, 7, 8]
, [ 9, 10, 11, 12]
, [13, 14, 15, 16]
]
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`); | |
export const wsObserver = ws | |
.pipe( | |
retryWhen(errors => | |
errors.pipe( | |
delay(1000) | |
) | |
) | |
); |
Sum a dimension N square matrix main and anti diagonal values.
Given the Matrix:
[ [ 1, 2, 3, 4]
, [ 5, 6, 7, 8]
, [ 9, 10, 11, 12]
, [13, 14, 15, 16]
]
/* | |
Optional adjustments for md-autocomplete in mobile screens | |
*/ | |
#place-autocomplete > md-autocomplete md-input-container { | |
margin-top: -10px; | |
} | |
/*Media query for tablets and above */ |
# Print most common words in a corpus collected from Twitter | |
# | |
# Full description: | |
# http://marcobonzanini.com/2015/03/02/mining-twitter-data-with-python-part-1/ | |
# http://marcobonzanini.com/2015/03/09/mining-twitter-data-with-python-part-2/ | |
# http://marcobonzanini.com/2015/03/17/mining-twitter-data-with-python-part-3-term-frequencies/ | |
# | |
# Run: | |
# python twitter_most_common_words.py <filename.jsonl> |
_.mixin({ pickSchema: function (model, excluded) { | |
var fields = []; | |
model.schema.eachPath(function (path) { | |
_.isArray(excluded) ? excluded.indexOf(path) < 0 ? fields.push(path) : false : path === excluded ? false : fields.push(path); | |
}); | |
return fields; | |
} | |
}); | |
// Example |
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set. | |
# Requires: numpy, sklearn, theano | |
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1' | |
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's. | |
# Similarly, for h * W_2 + b_2 | |
import theano | |
from theano import tensor as T | |
import numpy as np | |
from sklearn import datasets |
from theano import tensor as T, function | |
x = T.dscalar('x') | |
y = x ** 2 | |
dy = T.grad(cost=y, wrt=x) # Preparing symbolic gradient | |
df = function(inputs=[x], outputs=dy) | |
print(df(4)) # Output: 8 |
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) { | |
$scope.$on('authLoaded', function() { | |
$scope.isExpert($scope.main.serieId); | |
$scope.isMember($scope.main.serieId); | |
}); | |
$scope.loadAuth = function() { | |
Auth.load().success(function(data) { | |
$scope.main.user = data.user; | |
$scope.$broadcast("authLoaded"); |
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |