Skip to content

Instantly share code, notes, and snippets.

/*
Input Data Structure:
[
{
_id: "id",
date: "1-May-12",
close: 68.13,
open: 34.12
},
@tarzak
tarzak / gauge.js
Last active August 29, 2015 14:23 — forked from tomerd/gauge.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
var obj = {test: "(function () {alert('asd'); return true})"};
var test = eval(obj.test);
var test2 = test();
var test3 = "test()";
eval(test3);
Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});
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]);
}
}
}
}
@tarzak
tarzak / index.html
Last active August 29, 2015 14:12 — forked from enjalot/index.html
<!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">
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;
}
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;
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() {
@tarzak
tarzak / gist:b725e2a010181a8b6aa5
Created November 20, 2014 18:55
alternate window.onload
<script type="text/javascript">
function draw(){
var canvas = document.getElementById('tutorial');
if (canvas.getContext){
var ctx = canvas.getContext('2d');
}
}
</script>
</head>
<body onload="draw();">