Link to this (so meta): https://gist.github.com/powerc9000/5769891
All the cool kids are doing it!
and
Git helps us colaborate easier and manage the codebase.
| <html> | |
| <head> | |
| <title>Some page</title> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <p id="hello" class="hi">Hello World</p> | |
| <div class="hi hide-contain">Hey! | |
| <div class="hide hi"> |
| //Clay Murray | |
| //CS 1415 | |
| //A cool bank simulation with a queue | |
| #include <iostream> | |
| #include <queue> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| using namespace std; | |
| int randomWait(); |
| (function(window, undefined){ | |
| "use strict"; | |
| var headOn = (function(){ | |
| var vectorProto; | |
| var headOn = { | |
| groups: {}, | |
| _images: {}, | |
| fps: 50, | |
| imagesLoaded: true, |
| (function(window, undefined){ | |
| "use strict"; | |
| var headOn = (function(){ | |
| var vectorProto; | |
| var headOn = { | |
| groups: {}, | |
| _images: {}, | |
| fps: 50, | |
| imagesLoaded: true, |
| //include your images like thus | |
| //<img data-src=""> | |
| (function(){ | |
| var cache = document.querySelectorAll("[data-src]"); | |
| var c = document.createElement("canvas"); | |
| var ctx = c.getContext("2d"); | |
| for(var i=0; i<cache.length; i++){ | |
| var el = cache[i]; | |
| var url = el.getAttribute("data-src"); |
| //getting something by id | |
| var element = document.getElementById("idName"); //remeber to not use a "#" | |
| //getting something by class | |
| var elements = document.getElementsByClassName("className");//remeber not to user a "." | |
| //Notice that getElementsByClassName returns a collection not just a singular item. and although it is array like. it isn't an array | |
Link to this (so meta): https://gist.github.com/powerc9000/5769891
All the cool kids are doing it!
and
Git helps us colaborate easier and manage the codebase.
| var rooms = {}; | |
| io.sockets.on("connection", function(socket){ | |
| socket.on("create room", function(roomName){ | |
| if(!rooms[roomName]){ | |
| rooms[roomName] = []; | |
| } | |
| rooms[roomName].push(socket); | |
| }); | |
| socket.on("message", function(data){ | |
| rooms[data.roomName].forEach(function(s){ |
| function foo(){ | |
| var num = 20; | |
| return function(){ | |
| console.log(num); | |
| } | |
| } | |
| foobar = foo(); | |
| foobar(); |