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 objArr = WestUi.FriendsBar.friendsBarUi.friendsBar.getAllPlayers(), | |
friendsNames = [], | |
i = 0; | |
for (i = 0; i < objArr.length; i++) | |
friendsNames[i] = objArr[i].name; | |
console.log(friendsNames); |
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 objArr = WestUi.FriendsBar.friendsBarUi.friendsBar.getAllPlayers(), | |
friendsNames = objArr.map(function(item) { | |
return item.name; | |
}); | |
console.log(friendsNames); |
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
/** | |
* An implementation for Quicksort. Doesn't | |
* perform as well as the native Array.sort | |
* and also runs the risk of a stack overflow | |
* | |
* Tests with: | |
* | |
* var array = []; | |
* for(var i = 0; i < 20; i++) { | |
* array.push(Math.round(Math.random() * 100)); |
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();"> |
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
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
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
<!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
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
Router.map(function () { | |
this.route('index', { | |
controller: 'BasicController', | |
layoutTemplate: 'indexLayout', | |
path: '/', | |
waitOn: function () { | |
return Meteor.subscribe('Channels'); | |
} | |
}); |