Skip to content

Instantly share code, notes, and snippets.

View minimal-neuron.js
/*
A neuron is basically the sum of its synapses.
Along with a trigger threshold, that's all we need to calculate
whether or not it will trigger at any given moment:
*/
const neuron = ({ synapses = [], threshold = 1 } = {}) => ({
synapses,
threshold
});
@souparno
souparno / virtualhost.conf
Created Mar 13, 2017
apache configuration for node.js proxy
View virtualhost.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName cuboid.io
ServerAlias www.cuboid.io
DocumentRoot /var/www/cuboidio
<Directory />
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
@souparno
souparno / .conf
Created Jun 19, 2015
.conf file to create virtual host
View .conf
<VirtualHost *:80>
ServerName Bonfire.local
DocumentRoot /var/www/Bonfire.local
<Directory /var/www/Bonfire.local>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
@souparno
souparno / Combination Constructor & Prototype Pattern
Last active Jan 4, 2016 — forked from zacksleo/JavaScript Class
Combination Constructor & Prototype Pattern
View Combination Constructor & Prototype Pattern
/**
* Combination Constructor/Prototype Pattern
*/
//constructor
function Something(name){
//properties
this.name = name;
}
//prototype
@souparno
souparno / Javascript Inheritence
Last active Jan 3, 2016
A number of references on the javascript Class Framework/Class Implementation
View Javascript Inheritence
/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
View .bshrc
export ANDROID_HOME=/home/bonnie/Android/Sdk
export PATH=${ANDROID_HOME}/tools:${PATH}
export PATH=${ANDROID_HOME}/platform-tools:${PATH}
export PATH=${ANDROID_HOME}/build-toold:${PATH}
export PATH=${ANDROID_HOME}/../android-ndk-r10e:${PATH}
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
@souparno
souparno / gist:f077cb03f0339514bbcc
Created Nov 28, 2015 — forked from zachstronaut/gist:1184900
Stretch HTML5 canvas to fill window, preserving aspect ratio
View gist:f077cb03f0339514bbcc
/**
* fullscreenify()
* Stretch canvas to size of window.
*
* Zachary Johnson
* http://www.zachstronaut.com/
*
* See also: https://gist.github.com/1178522
*/
@souparno
souparno / building cordova with ant
Created Jul 12, 2015
building cordova with ant
View building cordova with ant
cordova build android -- --ant
View getApp.js
var app = require("express")();
app.get('/user', function(req, res){
res.send(200, { name: 'marcus' });
});
// In order to reach the app from other modules
// we need to export the express application
module.exports.getApp = app;
View linked list
import java.io.*;
class LinkedList {
Node last = null;
// function to create the link list
public void createList(int n) {
Node node = new Node();
node.value = n;