Skip to content

Instantly share code, notes, and snippets.

Avatar

Jameson Aranda jamesona

View GitHub Profile
View modal.js
/*
This is a modal class that creates a js object containing:
- a parent div, to use for things like dimming the page behind the dialog
- a title H1 containing whatever is passed as the title argument
- a body div containing whatever is passed as the body argument
A callback function will fire when the html is ready, if passed as a third argument.
Built-in methods:
- destroy() removes the dialog from the dom; takes no arguments
- attach() injects html model into the document; accepts a target node as argument;
View calendar.js
/*
This class defines a calendar factory.
Pass a dom node as an argument for the draw() method, to insert a
calendar as a child of the passed node (this replaces the node's contents).
Constructor parameters are month, year, and optional day data.
Valid JSON data is constructed as key-pairs of "mm/dd/yyyy: value"
EXAMPLE:
{ ...
mm/dd/yyyy: value,
mm/dd/yyyy: value,
View prompt.js
var Prompt = function(prompt){
var box = document.createElement('textarea');
box.placeholder = prompt;
box.style.width = "30vw";
box.style.height = "60vh";
box.style.marginTop = "20vh";
box.style.marginLeft = "35vw";
box.style.position = "fixed";
box.style.left = "0";
box.style.top = "0";
View date_extremes.js
var getBeginningDate = function(period, date){
var date = (date === undefined ? new Date() : new Date(date));
if (period) {
period = period.toLowerCase();
switch (period) {
case 'year':
date.setMonth(0);
case 'quarter':
if (date.getMonth() >= 9) {
date.setMonth(9);
View xkcd replacements
{
//set 1
"witnesses": "thse dudes I don't know",
"allegedly": "kinda probably",
"new study": "tumblr post",
"rebuild": "avenge",
"space": "spaaaace",
"google glass": "virtual boy",
"smartphone": "pokedex",
"electric": "atomic",
View rainbowify_messenger.js
var h = 0;setInterval(function(){document.querySelectorAll('.clearfix._nd_.direction_ltr.text_align_ltr .clearfix div').forEach(function(e,i,a){
e.style.backgroundColor = "hsl("+h+", 83%, 44%)"
})
if (h < 359)
h++
else
h = 0
}, 100)
View chessclock.html
<!doctype html>
<title>Chessclock</title>
<link href='https://fonts.googleapis.com/css?family=Nixie+One' rel='stylesheet' type='text/css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.5/mithril.min.js"></script>
<style>
* {
font-family: 'Nixie One', sans-serif;
color: #E41B21;
}
body, html {
View gist:8cbfe412edf20c7c9ac6988b61402f85
Austin: "Is Andrew's brother-in-law not getting hired then? Oh wait, no, it was his wife's brother, wasn't it? Oh wait... That's the same thing..."
Jameson: "Are we going to finish by the end of the day?" (In regards to a ~30 minute task, with 2 hours left in the day)
Jordan: "At the rate I'm going... No."
Matt: "Its time to decompose Kurt. Kurt, just lay down in the dirt for like, a long time."
Austin: "It looks great guys!"
Jordan: "...it looks awful..."
Austin: "Well, yeah, but"
View demo.html
<html>
<head>
<style>
.modal-container {
background: rgba(0,0,0,0.5);
display: block;
height: 100vh;
position: absolute;
left: 0;
top: 0;
You can’t perform that action at this time.