Skip to content

Instantly share code, notes, and snippets.

View hoorayimhelping's full-sized avatar

Bucky Schwarz hoorayimhelping

View GitHub Profile
diff --git a/js/src/edge.js b/js/src/edge.js
new file mode 100644
index 0000000..e829916
--- /dev/null
+++ b/js/src/edge.js
@@ -0,0 +1,24 @@
+var Edge = function(value) {
+ this.id = value || new Date().getTime();
+
+ this.nodes = {};
diff --git a/js/src/edge.js b/js/src/edge.js
new file mode 100644
index 0000000..e151541
--- /dev/null
+++ b/js/src/edge.js
@@ -0,0 +1,24 @@
+var Edge = function(value) {
+ this.id = value || new Date().getTime();
+
+ this.nodes = {};
diff --git a/js/src/graph.js b/js/src/graph.js
index 00ab25c..e4a61d5 100644
--- a/js/src/graph.js
+++ b/js/src/graph.js
@@ -21,6 +21,10 @@ Graph.prototype = {
return this.edges.some(function(edge) {
return edge.areAdjacent(node1, node2);
});
+ },
+
diff --git a/js/src/edge.js b/js/src/edge.js
index 7dc926b..67e776d 100644
--- a/js/src/edge.js
+++ b/js/src/edge.js
@@ -1,8 +1,8 @@
var Edge = function(options) {
- this.name = options.name;
+ this.props = options || {};
+ this.id = new Date().getTime();
diff --git a/gulpfile.js b/gulpfile.js
index 07ae90c..5fe0bd0 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -13,6 +13,10 @@ var paths = {
'js_dist': 'dist/'
};
+gulp.task('env', function() {
+ process.env.NODE_ENV = 'production';
diff --git a/js/data/solar_system.js b/js/data/solar_system.js
index 91a18a6..ba9eb16 100644
--- a/js/data/solar_system.js
+++ b/js/data/solar_system.js
@@ -1,53 +1,48 @@
var Node = require('../src/node');
var Edge = require('../src/edge');
-var newNode = function(id) {
- var node = new Node();
diff --git a/js/data/solar_system.js b/js/data/solar_system.js
index 91a18a6..c39442d 100644
--- a/js/data/solar_system.js
+++ b/js/data/solar_system.js
@@ -1,53 +1,48 @@
var Node = require('../src/node');
var Edge = require('../src/edge');
-var newNode = function(id) {
- var node = new Node();
diff --git a/gulpfile.js b/gulpfile.js
index cc55817..1df0002 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -8,7 +8,7 @@ var tape = require('gulp-tape');
var shell = require('gulp-shell');
var paths = {
- 'js_source': 'js/src/',
+ 'js_source': 'js/graph/',
diff --git a/gulpfile.js b/gulpfile.js
index 1df0002..3a223fa 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -3,9 +3,12 @@ var source = require('vinyl-source-stream');
var jshint = require('gulp-jshint');
var browserify = require('browserify');
+var reactify = require('reactify');
+
diff --git a/gulpfile.js b/gulpfile.js
index 07dc605..557fa54 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -13,7 +13,9 @@ var react = require('gulp-react');
var paths = {
'js_source': 'js/graph/',
'js_test': 'js/test/',
- 'js_dist': 'dist/'
+ 'js_dist': 'dist/',