Skip to content

Instantly share code, notes, and snippets.

View ProfAvery's full-sized avatar

Kenytt Avery ProfAvery

  • California State University, Fullerton
  • Fullerton, CA
View GitHub Profile
@ProfAvery
ProfAvery / db.json
Created March 8, 2016 19:29
CPSC 473 - Spring 2016 - Homework 4
{
"actors": [
{ "id": 1, "name": "Bryan Cranston", "starred": true },
{ "id": 2, "name": "Aaron Paul", "starred": true },
{ "id": 3, "name": "Bob Odenkirk", "starred": true },
{ "id": 4, "name": "Dean Norris", "starred": false }
]
}
@ProfAvery
ProfAvery / config.js
Last active March 7, 2016 08:51
CPSC 473 JSHint configuration
// Client-side code
/* jshint browser: true, jquery: true, curly: true, eqeqeq: true, forin: true, immed: true, indent: 4, latedef: true, newcap: true, nonew: true, quotmark: double, undef: true, unused: true, strict: true, trailing: true */
// Server-side code
/* jshint node: true, curly: true, eqeqeq: true, forin: true, immed: true, indent: 4, latedef: true, newcap: true, nonew: true, quotmark: double, undef: true, unused: true, strict: true, trailing: true */
@ProfAvery
ProfAvery / nudge.js
Last active June 16, 2023 01:26
Nudge - Web Interface for Git Push
#!/usr/bin/env node
"use strict";
var http = require("http"),
querystring = require("querystring"),
child_process = require("child_process");
function writeCSS(res) {
res.writeHead(200, {
@ProfAvery
ProfAvery / genlogs.c
Last active August 29, 2015 14:08
Generate fake log entries to stdout
/* genlogs.c - Generate fake log entries to stdout */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#define DATE_MAX_CHARS 25
#define SIZE(a) (sizeof(a) / sizeof(*(a)))
@ProfAvery
ProfAvery / config.yaml
Created September 10, 2014 05:56
Correctly indented config.yaml
message: This is a message defined in the configuration file config.yaml
messageRepetitions: 3
database:
driverClass: org.hsqldb.jdbc.JDBCDriver
user: cpsc476
password: Passw0rd
url: jdbc:hsqldb:hsql://localhost/cpsc476;ifexists=true
@ProfAvery
ProfAvery / build.xml
Last active October 24, 2016 04:08
Ant build file to run an HSQLDB Database Server
<?xml version="1.0" ?>
<!--
HSQLDB database server
Install Ant
Place this build.xml in a directory by itself
(e.g. C:\hsqldb or $HOME/hsqldb)
@ProfAvery
ProfAvery / form.html
Created March 6, 2014 07:00
Connect-ized form processing example with HTTP Basic
<% if (typeof message !== "undefined") { %>
<%= message %>
<% } %>
<form method="POST">
State:
<input type=text name="state"
<% if (typeof state !== "undefined") { %>
value="<%= state %>"
<% } %>
size="2" maxlength="2">
@ProfAvery
ProfAvery / form.html
Last active August 29, 2015 13:56
Form processing example from lecture
<% if (typeof message !== "undefined") { %>
<%= message %>
<% } %>
<form method="POST">
State:
<input type=text name="state"
value="<%= state %>" size=2 maxlength=2>
<input type="submit">
</form>
@ProfAvery
ProfAvery / shim.js
Created February 12, 2014 07:13
Shim for running simple Node.js modules with jrunscript
(function(global) {
if (typeof java !== "undefined") {
this.console = { log: function(s) { println(s); } }
// Download from https://raw.github.com/micmath/Rhino-Require/master/src/require.js
load("require.js");
}
}(this));
// Call console.log() and require() as usual
@ProfAvery
ProfAvery / test.js
Last active July 12, 2019 16:12
Using Underscore.js from the Node.js REPL
/*
Per <http://stackoverflow.com/questions/5691901/using-the-underscore-module-with-node-js>,
from the Node.js REPL, use two underscores (__) instead of a single underscore (_)
because Node uses _ for the last return value.
Note that if your program is in a file, you can still use a single underscore (_).
*/
var __ = require("underscore");
__.each([1, 2, 3], function(e) { console.log(e); });