Skip to content

Instantly share code, notes, and snippets.

Enigmatic Ape enigmaticape

Block or report user

Report or block enigmaticape

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@enigmaticape
enigmaticape / sicp_ex_1.10b.scm
Created Nov 5, 2012
h(n) = 2^(h(n-1)) defined iteratively. SICP Exercise 1.10
View sicp_ex_1.10b.scm
;h(n) = 2^(h(n-1)) defined iteratively.
(define (h-iter-aux num prod count)
(if (= count 1)
prod
(h-iter-aux num (expt num prod) (- count 1))))
(define (h-iter n)
(if (= n 0)
0
@enigmaticape
enigmaticape / csv2html.py
Created Nov 5, 2012
Very simple CSV to HTML table in Python
View csv2html.py
#!/usr/bin/python
import sys
import os
import csv
import string
if len( sys.argv ) < 2 :
sys.stderr.write( sys.argv[ 0 ] +
": usage - " +
@enigmaticape
enigmaticape / theme_list_tags_v1.0.php
Created Nov 5, 2012
wp_list_tags a-like, mimics (some of) the functionality of wp_list_categories
View theme_list_tags_v1.0.php
function theme_list_tags( $args ) {
$current_url = $_SERVER['REQUEST_URI'];
/* get_tags shares a subset of its parameters with
wp_get_catgeories, :
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true
@enigmaticape
enigmaticape / theme_get_archives_link.php
Created Nov 5, 2012
Wordpress PHP function which adds CSS class to currently selected archive list item
View theme_get_archives_link.php
@enigmaticape
enigmaticape / HTTPMessage.h
Created Nov 6, 2012
Minimal (ish) HTTP server in ObjC using GCD socket dispatch
View HTTPMessage.h
#import <Foundation/Foundation.h>
@interface HTTPMessage : NSObject
@property (nonatomic, readonly) CFHTTPMessageRef request;
- ( BOOL ) isRequestComplete:(NSData *) append_data;
@end
View minimalweb.py
import web
urls = (
'/', 'index'
)
class index:
def GET (self):
return "Post some data!"
@enigmaticape
enigmaticape / main.m
Created Nov 9, 2012
You want to use NSObject performSelector with multiple parameters, but you can't ?
View main.m
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#import <objc/message.h>
@interface AmazingClass : NSObject
- ( void ) doMultipleAmazingStuff;
@end
@implementation AmazingClass
@enigmaticape
enigmaticape / ObjCWebService.m
Created Nov 9, 2012
Almost as small as the Python version,but not quite
View ObjCWebService.m
#import <Foundation/Foundation.h>
#import "HttpService.h"
@implementation WebService {
HttpService * _service;
}
- ( HTTPResponse * ) GET:( HTTPRequest * ) request {
@enigmaticape
enigmaticape / part1.m
Created Nov 14, 2012
You want to use NSObject performSelector with multiple parameters, but you can't ? (1)
View part1.m
- ( id ) methodWithOneParam:( id ) theParam {
// Do amazing stuff
return @"Srsly, Amazing!";
}
- ( id ) methodWithFirst:( id ) firstParam
andSecond:( id ) secondParam
{
// Do doubly amazing stuff
@enigmaticape
enigmaticape / Invoker.h
Created Nov 17, 2012
Wrapping NSInvocation for fun and profit, for values of profit that include a better peformSelector
View Invoker.h
#import <Foundation/Foundation.h>
@interface Invoker : NSObject
+ ( NSValue * ) invoke:( SEL ) selector onTarget:( id ) target, ...;
@end
You can’t perform that action at this time.