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 / 8ball.py
Created April 25, 2013 06:30
Magic 8-Ball example (Bottle, Redis, JSON)
#!/usr/bin/env python
import random
from bottle import route, run, request, install
from bottle_redis import RedisPlugin
install(RedisPlugin())
@route('/ask')
@ProfAvery
ProfAvery / nginx.conf
Created May 8, 2013 04:35
Nginx load-balancing test configuration
# Modify Bottle application as follows:
# import sys
# ...
# run(port=sys.argv[1], debug=True)
#
# Then run
# python app.py 8081
# python app.py 8082
# nginx -p . -c nginx.conf
#
@ProfAvery
ProfAvery / .profile.cmd
Last active December 22, 2015 19:09
How to create a .profile file for Windows
@echo off
REM Enable by running the following command:
REM reg add "HKCU\SOFTWARE\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d ^%USERPROFILE^%\.profile.cmd /f
set HOME=%USERPROFILE%
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_01
set PATH=%JAVA_HOME%\bin;%PATH%
set ANT_HOME=C:\apache-ant-1.9.2
Question from fishygut:
What are the main differences between Java EE 7 and Java EE 6 ?
4 Answers
puffstone: Support for JSON
barkingcustard: GlassFish v4
puffstone: Improved Bean Validation
barkingcustard: WebSocket support
@ProfAvery
ProfAvery / build-snippet.xml
Last active December 25, 2015 02:29
Maven Ant Tasks <artifact:dependencies> task for ObjectDB
<artifact:dependencies pathId="dependency.classpath">
<remoteRepository id="objectdb" url="http://m2.objectdb.com" />
<dependency groupId="com.objectdb" artifactId="objectdb" version="2.5.3_02" />
</artifact:dependencies>
@ProfAvery
ProfAvery / test.html
Created February 6, 2014 02:57
HTML5 + JavaScript Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Test</title>
</head>
<body>
...
<script src="test.js"></script>
</body>
@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); });
@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 / 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 / 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">