Skip to content

Instantly share code, notes, and snippets.

View danprince's full-sized avatar

Dan Prince danprince

View GitHub Profile

#Lecture 1#

##Distributed Systems## A system in which hardware or software components located at networked computers communicate and coordinate their actions only by message passing
A distributed system is a collection of independent computers that appear to the users of the system as a single computer.
A distributed system is a collection of autonomous computers linked by a network with software designed to produce an integrated computing facility.

##Distributed Systems vs Computer Networks## Computer Network: An interconnected collection of autonomous computers able to exchange messages based on protocols. Network entities are visible and they are explicitly addressed (IP address). Networks focuses on packets and routing.

@danprince
danprince / addRemove.js
Created May 18, 2014 00:56
Quick jQuery style add/remove class implementation.
(function() {
// Helper which turns class string into array
function getClassList(element) {
return element.getAttribute('class').split(' ');
}
// Add class with this name to the element
function addClass(name) {
var classes = getClassList(this);
//spr_EnemyDead is a speparate sprite that contains the image of the enemy rotated slightly.
//Trying to get enemy once hit, to switch to spr_EnemyDead and then fall off screen, at the moment, as soon
//as player bounces off head he switches back to alive sprite.
//Enemy Movement
hsp = dir * movespeed;
vsp += grav;
sprite_index = spr_enemy
//Horizontal Collision
@danprince
danprince / spec.md
Last active August 29, 2015 14:03
Firebase Spec

#Core ##References Creation from

  • Path String
  • Parent Reference, child method
  • In a list with push

##Sorting and Limiting

##Events

@danprince
danprince / styleguide.md
Last active August 29, 2015 14:03
Javascript Guide

Dan's Guide to Javascript (Working Progress)

###Two Space Indents Do not use tab characters. All indents should be two spaces wide and the tab key should be set to insert soft tabs in your editor.

function action(intent) {
  function compile(element, listeners) {
    if(intent) {
      element.addEventListener('click', listeners.click);
    }
@danprince
danprince / jsbin.lodahemi.html
Created July 4, 2014 16:18
Checkbox to Yes/No in Pure CSS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<input type='checkbox'/>
</body>
</html>
@danprince
danprince / EventEmitter.js
Created September 1, 2014 17:25
Generic Event Emitter
module.exports = function() {
var handlers = {};
function _register(name) {
return handlers[name] || handlers[name] = [];
}
function on(name, handler) {
var event = _register(name);
event.push(handler);
@danprince
danprince / module.js
Last active August 29, 2015 14:07
Module System and Angular Style Dependency Injection 63 lines of Javascript.
(function(window) {
// global module list
var modules = {};
// require a module
window.require = function(name) {
return modules[name];
};
@danprince
danprince / index.html
Created October 18, 2014 13:01
No Problem // source http://jsbin.com/vovequ
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>No Problem</title>
<link rel='stylesheet' href='styles/base.css'/>
<link rel='stylesheet' href='styles/theme.css'/>
</head>
<body>
<div class='really'>