Skip to content

Instantly share code, notes, and snippets.

View powerc9000's full-sized avatar
🧺

Clay Murray powerc9000

🧺
View GitHub Profile
<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">
@powerc9000
powerc9000 / CS1415Lab14.cpp
Created April 18, 2014 01:53
Lab 14 is CS1415 I have to tutor and it will be nice to have the code for people to look at
//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();
@powerc9000
powerc9000 / raycast.js
Last active August 29, 2015 13:56
raycaster it's slow will speed it up
(function(window, undefined){
"use strict";
var headOn = (function(){
var vectorProto;
var headOn = {
groups: {},
_images: {},
fps: 50,
imagesLoaded: true,
@powerc9000
powerc9000 / head-on.js
Last active December 30, 2015 05:39
Head-on.js from bullet-dodge2 to work with in jsfiddle without requirejs
(function(window, undefined){
"use strict";
var headOn = (function(){
var vectorProto;
var headOn = {
groups: {},
_images: {},
fps: 50,
imagesLoaded: true,
@powerc9000
powerc9000 / cacher.js
Created July 10, 2013 18:38
Loads images and caches them in local storage. If the image exists in localStorage it loads it from the cache. NOTE: Because of cross origin policy it will only cache images belonging to the same domain as the webpage.
//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");
@powerc9000
powerc9000 / no-jquery1.js
Created June 19, 2013 22:45
Querying without jquery
//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
@powerc9000
powerc9000 / present.md
Last active December 18, 2015 10:39
My git presentation
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){
@powerc9000
powerc9000 / dom.md
Last active December 17, 2015 12:09
What we want to do for the DOM manipulation library

Some DOM library

The goal here is to make a DOM manipulation library like unto jQuery for practice and to learn javascript more fully and completely

Select things

  • By tag
  • By class
  • By Id
function foo(){
var num = 20;
return function(){
console.log(num);
}
}
foobar = foo();
foobar();