Skip to content

Instantly share code, notes, and snippets.

View CarterA's full-sized avatar

Carter Allen CarterA

View GitHub Profile
The issue I am having has to do with something about the way I am requiring classes, and maybe a bit to do with inheritance issues. The basic concept is:
Site: Creates a bunch of File and Page instances, calls the process() method on each one, then returns.
File: Manages the metadata and converter settings for a given file.
Page: Inherits from File. Eventually it will have a different process() implementation, so that pages are processed separately from other files.
I want to create File instances for every file in a given directory, except for files that are .html. Those should be created as Pages, not files. Get it?
Yet currently, when I call process() (line 57, site.js), it says that the method doesn't exist. What gives?
python tools/test.py --mode=debug,release
=== debug test-init ===
Path: simple/test-init
node.js:114
throw e; // process.nextTick error, or 'error' event on first tick
^
AssertionError: `node fs` failed!
at /Users/carterallen/Development/Shared/Third Party/Node.js/test/simple/test-init.js:36:14
at ChildProcess.exithandler (child_process.js:81:7)
at ChildProcess.emit (events.js:45:17)
@CarterA
CarterA / frack.c
Created May 22, 2011 05:03
Frack!
//
// frack.c
// frack
//
// Created by Carter Allen on 5/21/11.
// Copyright 2011 Opt-6 Products, LLC. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@CarterA
CarterA / gist:1257894
Created October 2, 2011 20:32
Better Singletons in Objective-C
@implementation Singleton
+ (Singleton *)sharedInstance {
static Singleton *globalInstance;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
globalInstance = [[self alloc] init];
});
return globalInstance;
}
@CarterA
CarterA / gist:1257903
Created October 2, 2011 20:36
Ridiculous Optimization
(function(){if(!/*@cc_on!@*/0)return;var e="abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(',');for(var i=0;i< e.length;i++){document.createElement(e[i]);}})();
@CarterA
CarterA / printHeader.rb
Created October 2, 2011 20:40
Streamlined Yardwork
require "term/ansicolor"
include Term::ANSIColor
def printHeader headerText
print bold + blue + "==> " + reset
print bold + headerText + reset + "\n"
end
@CarterA
CarterA / borderRadius.css
Created October 2, 2011 20:50
About This Website
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
behavior: url(/stylesheets/PIE.htc);
// Create and fill a buffer for with the raw markdown data.
struct sd_callbacks callbacks;
struct html_renderopt options;
const char *rawMarkdown = [markdownContent cStringUsingEncoding:NSUTF8StringEncoding];
struct buf *inputBuffer = bufnew(strlen(rawMarkdown));
bufputs(inputBuffer, rawMarkdown);
// Parse the markdown into a new buffer using Sundown.
struct buf *outputBuffer = bufnew(64);
sdhtml_renderer(&callbacks, &options, 0);
@CarterA
CarterA / main.c
Created December 21, 2011 01:00
FizzBuzz
//
// main.c
// FizzBuzz
//
// Created by Carter Allen on 12/20/11.
// Copyright (c) 2011 Opt-6 Products, LLC. All rights reserved.
//
#include <stdio.h>
@CarterA
CarterA / Brute Force Primality Test.c
Created January 10, 2012 06:26
Primality Testing and Factorization in C
int bruteForcePrimalityTest(long int n) {
for (long int i = 2; i < n; i++) {
if (n % i == 0) return 0;
}
return 1;
}