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
const map = (xs, fn) => { | |
const _map = ([x, ...xs], fn, result) => ( | |
x === undefined | |
? result | |
: _map(xs, fn, [...result, fn(x)]) | |
) | |
return _map(xs, fn, []); | |
} | |
const filter = (xs, fn) => { |
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 input = [ 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0 ]; | |
var expected = [ 1, 0, 1, 0, 0, 0, 1, 1, 1 ]; | |
var hiddenLayers = initHiddenLayers([ 18, 17, 15, 6, expected.length ]); | |
var neuralLayers = flatten([ [ input ], hiddenLayers ]); | |
var count = 0; | |
var start = Date.now(); | |
var neuralNetwork = computeNeuralNet( neuralLayers, expected, [], 0 ); |
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
function validateTypes( type, value, shouldLog ) { | |
/* --------- Type Checker --------- */ | |
function _typeOf( item ) { | |
return Object.prototype.toString.call( item ).slice( 8, -1 ); | |
} | |
function checkPrimitiveType( type, value, errorLog ) { | |
var isValid = ( type == _typeOf( value ) ); |
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
function isValidType( type, value ) { | |
function getType( item ) { | |
return Object.prototype.toString.call( item ).slice( 8, -1 ); | |
} | |
function checkPrimitiveType( type, value ) { | |
return type == getType( value ); | |
} |
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
function tag( type, attrs ) { | |
attrs = attrs || {}; | |
return function tagTemplate( content ) { | |
return [ | |
startTag( type, attrs ), | |
content, | |
endTag( type ) | |
].join(' '); | |
} | |
} |
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 Employees = [{ | |
id: 0, | |
name: "sandeep", | |
skills: [ "Javascript", "Angular" ], | |
experience: 2, // add later | |
salary: 100 | |
}, | |
{ | |
id: 1, | |
name: "Abhishek", |
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
function flatten( arr ) { return [].concat.apply( [], arr ) } | |
function arrayOfSize( size, n ) { | |
n = n || 0; | |
return ( new Array( size + 1 ) ).join( '0' ).split( '' ) | |
.map( function ( _ ) { return n } ); | |
} | |
function createMatrix( size ) { | |
return arrayOfSize( size ).map( function ( row, rowIndex ) { |
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
function tag( type, attrs ) { | |
attrs = attrs || {}; | |
return function tagTemplate( content ) { | |
return [ | |
startTag( type, attrs ), | |
content, | |
endTag( type ) | |
].join(' '); | |
} | |
} |
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
(def points [{:x 1, :y 1} {:x -1, :y 1} {:x -1, :y -1} {:x 1, :y -1} {:x 2, :y 2} {:x -1, :y 2} {:x -1, :y -2} {:x 1, :y -2} {:x 1, :y 6} {:x -1, :y 4} {:x -3, :y -1} {:x 1, :y -1} {:x 10, :y 1} {:x -1, :y 11} {:x -1, :y -1} {:x 1, :y -1}]) | |
(defn samePolarity? [a b] (if (or (and (< a 0) (< b 0)) (and (>= a 0) (>= b 0))) true false)) | |
(defn square-magnitude [a b] (+ (* a a) (* b b))) | |
(defn | |
largestVectorInQuadrant | |
[points x y] | |
(->> |
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
openssl genrsa -des3 -out <server.key> 1024 | |
openssl req -new -key <server.key> -out <server.csr> | |
openssl rsa -in <server.key>.rzt -out <server.key> | |
openssl x509 -req -days 365 -in <server.csr> -signkey <server.key> -out <server.crt> |