Skip to content

Instantly share code, notes, and snippets.

View cwndrws's full-sized avatar

Charlie Andrews cwndrws

  • GitHub
  • RVA
View GitHub Profile
var Pool = require('sandcastle').Pool;
var sandboxPath = __dirname + '/sandbox-api.js';
var s = new Pool({numberOfInstances: 20}, {api: sandboxPath, timeout: 30000, useStrictMode: false});
function callCode(code, callback) {
var script = s.createScript(code);
script.on('exit', function(err, output) {
if (output) {
callback(output);
@cwndrws
cwndrws / .emacs
Created August 18, 2014 17:07
My emacs config
(setq custom-file "~/.emacs-custom.el")
(load custom-file)
(package-initialize)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;; efff the chrome
(tool-bar-mode -1)
(scroll-bar-mode -1)
(defcustom ftw-leader-key "C-a"
"Customizable contol key for ftw navigation")
(defun left-edge (win)
(let ((edges (window-edges win)))
(nth 0 edges)))
(defun right-edge (win)
(let ((edges (window-edges win)))
(nth 2 edges)))
@cwndrws
cwndrws / emacs
Created August 13, 2014 02:21
asdfasdf
(add-to-list 'load-path "~/.emacs.d/ftw/")
(require 'ftw)
(setq ftw-leader-key "C-;")
@cwndrws
cwndrws / Postgres
Created August 5, 2014 19:15
Postgres init script
#!/bin/sh
set -e
### BEGIN INIT INFO
# Provides: postgresql
# Required-Start: $local_fs $remote_fs $network $time
# Required-Stop: $local_fs $remote_fs $network $time
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
@cwndrws
cwndrws / uuidStringBench_test.go
Created May 21, 2014 20:16
Benchmark showing the proposed new way to stringify uuid's in gocql
package uuidStringBench
import (
"testing"
"github.com/gocql/gocql"
"fmt"
)
var (
u gocql.UUID
@cwndrws
cwndrws / convertJson
Last active August 29, 2015 13:56
the change I had to make to the convertJsonToJsonObject() method in the Item class.
private JsonObject convertJsonToJsonObject(String json) {
// parse json string in to JsonElement
try {
JsonElement toObject = new JsonParser().parse(json);
return toObject.getAsJsonObject();
}catch(JsonSyntaxException mfe){
return null;
// This was screwing me up a lot
}catch(IllegalStateException ise){
@cwndrws
cwndrws / allUsers.json
Last active January 3, 2016 06:09
fake json representation of all users in a system
[
{
"creation_date":"2008-09-08T22:47:31-07:00",
"email":"[email protected]",
"extra_info":{
"birthday":"1/1",
"haircolor":"brown"
},
"status":true
},
@cwndrws
cwndrws / gist:8133848
Created December 26, 2013 13:28
Program that produces error on truncate.
package main
import (
"tux21b.org/v1/gocql"
"log"
)
var cluster *gocql.ClusterConfig
func init() {
public void add() {
Node newNode = Node();
addChild(root, newNode);
}
public void addChild(Node parent, Node child) {
if (parent.leftChild == null) {
parent.leftChild = child;
} else if (parent.rightChild == null) {
parent.rightChild = child;