Skip to content

Instantly share code, notes, and snippets.

View jaywon's full-sized avatar

Jason Sewell jaywon

View GitHub Profile
// Set up base class DIV
function Div(name){
this.name = name;
this.element = null;
}
Div.prototype.draw = function(){
// $("p").append("<div>Div</div>");
console.log('draw works');
this.element = $("<div>Div</div>");
//Main Class
//Create base div class
function Div(){
this.color = null;
this.htmlElement = null;
this.draw = function (){
this.htmlElement = $("<div>"+this.color+"</div>");
$('body').append(newDiv);
}
}
@jaywon
jaywon / gist:381f8a88d9a4894b3c2e
Created August 8, 2014 07:19
Method inheritance from base class called from sub classes and switching context
//Main Class
//Create base div class
function Div(){
this.color = null;
this.htmlElement = null;
this.draw = function (){
this.htmlElement = $("<div>"+this.color+"</div>");
$('body').append(this.htmlElement);
};
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
function Box(){
//constructor goes here
this.name = "Box";
}
Box.prototype.draw = function() {
console.log(this.name + " drawing!");
};
console.log("Box prototype", Box.prototype);

Meteor

Installation

  • Meteor: $ curl https://install.meteor.com/ | sh
  • Meteorite(deprecated): $ npm install -g meteorite
  • Yo: $ npm install -g yo
  • Meteor Generator: $ npm install -g generator-meteor
Boxes = new Meteor.Collection("boxes");
if (Meteor.isClient) {
var allBoxes = Boxes.find();
allBoxes.observe({
changed: function(doc, index){
console.log(doc);
}
<head>
<title>tempDrag</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> boxContainer}}
</body>
<template name="boxContainer">
@jaywon
jaywon / gist:2b31c7cb299fe585ea1d
Created December 15, 2014 04:35
Tutoring Example
<html>
<head>
<script src="js/mail-generator.js"></script>
<link href="css/style.css" rel="stylesheet" media="screen">
<script>
window.onload = function(){
// ALL OF YOUR JAVASCRIPT CODE SHOULD GO HERE.
// We have to use window.onload so your JavaScript doesn't execute until the page has loaded and all HTML has been downloaded to your browser
//MAIN FUNCTIONALITY
@jaywon
jaywon / meteorinit
Last active August 29, 2015 14:12
Meteor Structure Generation Script
#!/bin/bash
mkdir docs
mkdir -p src/client/collections
mkdir -p src/client/compatibility
mkdir -p src/client/conf
mkdir -p src/client/lib
mkdir -p src/client/routers
mkdir -p src/client/startup
mkdir -p src/client/stylesheets
mkdir -p src/client/subscriptions