Skip to content

Instantly share code, notes, and snippets.

View jonarnaldo's full-sized avatar

Jon Arnaldo jonarnaldo

  • San Francisco Bay Area
View GitHub Profile
function isObject(value) {
const type = typeof value;
return value != null && type === 'object';
}
function trackTealium(category, action, label, value, nonInteraction = false) {
let eventData;
if (isObject(category)) {
eventData = category;
console.log("hello")
Template.profile.helpers ({
person : function() {
return People;
}
});
People = [
{name: "The Dude",age: "Age is relative, man.", occupation: "abiding"},
{name: "Bill Murray", age: 63, occupation: "actor"}
];
@jonarnaldo
jonarnaldo / gist:9938448
Last active August 29, 2015 13:58
Meteor template
<template name = "profile">
<#each person>
<div>
Name : {{ name }} <br>
Age : {{ age }} <br>
Occupation: {{ occupation }}
</div>
</each>
</template>
@jonarnaldo
jonarnaldo / gist:9777695
Created March 26, 2014 06:16
Binary Search
var newArr = [1, 2, 3, 4, 5, 6];
function binarySearch(searchElement) {
var minIndex = 0;
var maxIndex = this.length - 1;
var currentIndex;
var currentElement;
while (minIndex <= maxIndex) {
currentIndex = Math.round((minIndex + maxIndex) / 2);
@jonarnaldo
jonarnaldo / Sieve of Eratosthenes
Created February 25, 2014 04:32
Javascript Sieve of Eratosthenes
var Eratosthenes = function (n) {
this.array = function () {
var arr = [];
var output = [];
for (var i = 0; i < n; i++) {
arr.push(i);
}
return arr;
};
@jonarnaldo
jonarnaldo / Blackjack
Created February 25, 2014 04:27
Javascript Blackjack
/*Object Oriented Blackjack
A Game has: Players
Dealer
Deck
A Player / Dealer has: Score
Cards
A Score has: Game Logic