Skip to content

Instantly share code, notes, and snippets.

@formula1
formula1 / sketch.txt
Created September 16, 2014 03:16
Poetry at Droplabs
The sketch:
A [poop] enters a pet shop.
Mr. Praline: 'Ello, I wish to [throw] a [today].
(The owner does not [fart].)
Mr. Praline: 'Ello, [it]?
Owner: What do you [gentle] "miss"?
@formula1
formula1 / gist:3f49d9b46a2c0cb68625
Last active August 29, 2015 14:07
Basic Plugin admin page
<?php
/**
* Plugin Name: PDF to Post
* Description: Allows Admin to add a pdf and turns it into a post
* Version: 0.1
* Author: Sam Tobia/Mike Wagner
* License: GPL2
*/
add_action('admin_menu', 'my_plugin_menu');
@formula1
formula1 / webapp.js
Created November 9, 2014 21:22
An Example of a Possible Websocket Application
function Application(href){
EventEmitter.call(this);
this.href = href;
var that = this;
socket.on("open", function(){
while(that.backlog.length > 0)
that.socket.send(that.backlog.shift());
that.emitEvent("open",arguments)
})
socket.on("message", function(msg,flags){
var ee = require('events').EventEmitter;
function some_cuteness(next){
var our_event = new ee();
var functioned = 0;
cb("we're in the main");
@formula1
formula1 / gist:07d23b0e3842c7658f8d
Created November 19, 2014 10:37
JSPath Example
var j = {"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
"servlet-class": "org.cofax.cds.CDSServlet",
"init-param": {
"configGlossary:installationAt": "Philadelphia, PA",
"configGlossary:adminEmail": "[email protected]",
"configGlossary:poweredBy": "Cofax",
"configGlossary:poweredByIcon": "/images/cofax.gif",
@formula1
formula1 / gist:1c12acb2b21beb3943c7
Last active August 29, 2015 14:09
Heres a Completely untested Wrapper
function PathWrapper(path,subs,ctx){
if(typeof ctx == "undefined"){
ctx = subs;
subs = void(0);
}
this.ctx = ctx;
return this.prep(path,subs);
}
PathWrapper.prototype.prep = function(path,subs){
@formula1
formula1 / gist:62cef83c97de8557a912
Created December 1, 2014 00:32
Stuntman Node Psuedo
v8::Array convertAttribute(AuthAttrubutes pAttribute){
Local<Object> ret = Object::New();
ret->Set(
String::NewSymbol("user"),
v8::String::New(pAttribute.szUser)
);
ret->Set(
String::NewSymbol("realm"),
<!doctype html>
<html>
<!-- This is a comment, you won't see thin except if you look at the code -->
<!-- Doctype is necessarry for every html page. You used to need to specify the type, but nowadays all you need to specify is html -->
<!-- the html tag is necessary and always is the biggest box. But technically isn't seen -->
<!-- (however technically is, you'll understand one day) -->
<head>
<!-- the head is never seen. however it gets loaded before what gets seen does -->
</head>
<body>
@formula1
formula1 / gist:b7677d575182be6386ba
Last active August 29, 2015 14:11
Python to JS skeleton convert
//!/usr/bin/env node
var fs = require("fs");
var curclass = [];
var lastws = 0;
var curws = 0;
var multi = false;
var req = [];
var lastline = "";
/**
* @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
/*
* Copyright 2014, Gregg Tavares.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without