This file contains hidden or 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
| /* | |
| Input Data Structure: | |
| [ | |
| { | |
| _id: "id", | |
| date: "1-May-12", | |
| close: 68.13, | |
| open: 34.12 | |
| }, | |
This file contains hidden or 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 Gauge(placeholderName, configuration) | |
| { | |
| this.placeholderName = placeholderName; | |
| var self = this; // for internal d3 functions | |
| this.configure = function(configuration) | |
| { | |
| this.config = configuration; | |
This file contains hidden or 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 obj = {test: "(function () {alert('asd'); return true})"}; | |
| var test = eval(obj.test); | |
| var test2 = test(); | |
| var test3 = "test()"; | |
| eval(test3); |
This file contains hidden or 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
| Router.map(function () { | |
| this.route('index', { | |
| controller: 'BasicController', | |
| layoutTemplate: 'indexLayout', | |
| path: '/', | |
| waitOn: function () { | |
| return Meteor.subscribe('Channels'); | |
| } | |
| }); |
This file contains hidden or 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 compare(arr1, arr2) { | |
| for(var i = 0; i < arr1.length; i += 1) { | |
| for(var j = 0; j < arr2.length; j += 2) { | |
| if (arr1[i].id === arr2[j].id) { | |
| arr1.splice(i,1,arr2[j]); | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <title>Testing Pie Chart</title> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script> | |
| <style type="text/css"> |
This file contains hidden or 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 arr = [1,2,3,4,5,6,7,8]; | |
| var lookArr = function(array, callback) { | |
| var i = 0, | |
| len = array.length; | |
| if (typeof callback !== 'function') { | |
| callback = false; | |
| } |
This file contains hidden or 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
| Template.simpleCounter.rendered = function () { | |
| var btn = document.getElementById('btn'), | |
| input = document.getElementById('input'), | |
| sum = Money.findOne({name: "Total"}).total, | |
| tmp = 0, | |
| totalId; | |
| totalId = Money.findOne({name: "Total"})._id; |
This file contains hidden or 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
| PostsListController = RouteController.extend({ | |
| template: 'postsList', | |
| increment: 5, | |
| limit: function() { | |
| return parseInt(this.params.postsLimit) || this.increment; | |
| }, | |
| findOptions: function() { | |
| return {sort: {submitted: -1}, limit: this.limit()}; | |
| }, | |
| waitOn: function() { |
This file contains hidden or 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
| <script type="text/javascript"> | |
| function draw(){ | |
| var canvas = document.getElementById('tutorial'); | |
| if (canvas.getContext){ | |
| var ctx = canvas.getContext('2d'); | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body onload="draw();"> |