Skip to content

Instantly share code, notes, and snippets.

View marshall007's full-sized avatar

Marshall Cottrell marshall007

View GitHub Profile
@marshall007
marshall007 / gist:1063089
Created July 4, 2011 08:49
Working Netstats socket-based message passing.
MacPro-31:~ marshall$ telnet localhost 9999
Trying ::1...
Connected to localhost.
Connection closed by foreign host.
MacPro-31:~ marshall$ telnet localhost 9999
Trying ::1...
Connected to localhost.
r
Available options:
ping
@marshall007
marshall007 / gist:1091246
Created July 19, 2011 03:27
POST: player=marshall007
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 343
{
"player": "marshall007",
"stats":
{
"on": "0",
"seen": "1310019287697",
@marshall007
marshall007 / gist:1091249
Created July 19, 2011 03:28
POST: player=all
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 712
{
{
"player": "marshall007",
"stats":
{
"on": "0",
@marshall007
marshall007 / picker.js
Created August 17, 2011 03:04
ProductPicker Design Pattern
// local namespace
(function( $ ) {
// namespace constants
// application namespace
ProductPicker = function(opts) {
var self = {};
var defaults = {
target: '#picker',
state: {
@marshall007
marshall007 / gist:1176323
Created August 28, 2011 06:35
PickACard Uncaught Exception
06:50:02 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'pac' in plugin PickACard v1.3
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:352)
at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:737)
at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:701)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:694)
at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
@marshall007
marshall007 / app.js
Created August 29, 2011 23:29 — forked from davemo/app.js
A way to add declarative bindings using jQuery and a simple module pattern.
// Given a simplified module pattern like so:
(function(APP, $, _) {
APP.MyWidget = function(opts) {
var self = {};
var defaults = {
// an array of contexts and declarative event bindings
bindings : [
{
@marshall007
marshall007 / gist:1180027
Created August 30, 2011 02:34
Loading the decks
public void load() {
Configuration deckConfig = new Configuration(new File(plugin.dir + "decks.yml"));
deckConfig.load();
LinkedList<Card> savedDeck = null;
int s, r;
LinkedList<String> deck = (LinkedList) deckConfig.getStringList("decks." + deckName, null);
for (int i=0; i<deck.size(); i++) {
String[] temp = deck.get(i).split("-");
@marshall007
marshall007 / deck.yml
Created September 1, 2011 01:26
New Deck
decks:
default:
draw:
- 0-0
- 1-0
- 2-0
- 3-0
- 4-0
- 5-0
- 6-0
@marshall007
marshall007 / cards.yml
Created September 1, 2011 05:00
Example config file
easy:
2-5:
- Descriptions
- Descriptions
- Descriptions
- Descriptions
6-10:
- Descriptions
- Descriptions
- Descriptions

Modules

Code Structure

ProductPicker.Module = function(opts) {

    // private data
    var self = {};
    var defaults = {
        target: $('#ppModule'),
 tab: $('#ppTabModule'),