Skip to content

Instantly share code, notes, and snippets.

View razorthink-com's full-sized avatar

razorthink-com

  • Razorthink
View GitHub Profile
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) => {
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 );
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 ) );
function isValidType( type, value ) {
function getType( item ) {
return Object.prototype.toString.call( item ).slice( 8, -1 );
}
function checkPrimitiveType( type, value ) {
return type == getType( value );
}
function tag( type, attrs ) {
attrs = attrs || {};
return function tagTemplate( content ) {
return [
startTag( type, attrs ),
content,
endTag( type )
].join(' ');
}
}
var Employees = [{
id: 0,
name: "sandeep",
skills: [ "Javascript", "Angular" ],
experience: 2, // add later
salary: 100
},
{
id: 1,
name: "Abhishek",
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 ) {
function tag( type, attrs ) {
attrs = attrs || {};
return function tagTemplate( content ) {
return [
startTag( type, attrs ),
content,
endTag( type )
].join(' ');
}
}
(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]
(->>
@razorthink-com
razorthink-com / create-ssl.txt
Created June 29, 2015 22:03
Create SSL Certificate with OpenSSL
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>