Skip to content

Instantly share code, notes, and snippets.

View kballenegger's full-sized avatar

Kenneth Ballenegger kballenegger

View GitHub Profile
@kballenegger
kballenegger / react.js.wisp
Last active December 6, 2016 12:41
ReactJS macro in wisp
; note: this iteration doesn't work properly.
; looks like i don't understand exactly how react.js works for settings dom element properties
(set! exports {})
; react macros...
(defmacro hash-map-pairs
"make a hash map from its arguments. each argument is a tuple (key value)"
@kballenegger
kballenegger / string-enums.m
Last active February 19, 2016 05:47
Strings as enum values
NSString *const kCBLocationAtStartupString = @"startup";
// etc ...
typedef NS_ENUM(NSString *, CBLocation) {
CBLocationAtStartup = kCBLocationAtStartupString,
// etc.
};
- (void)showInterstitial:(CBLocation)location {
NSString *locationString = (NSString *)location
//
// File.c
//
//
// Created by Kenneth Ballenegger on 1/13/14.
//
//
#include <stdlib.h>
#include <stdio.h>
@kballenegger
kballenegger / FieldCreation.m
Last active December 31, 2015 16:38
Custom window problem
{
NSView *emailFieldContainer = [[NSView alloc] initWithFrame:NSMakeRect(80.0/2, 150.0/2, 650.0/2, 60.0/2)];
self->emailField = [[NSTextField alloc] initWithFrame:NSMakeRect(10.0/2, 10.0/2, 670.0/2, 40.0/2)];
self->emailField.stringValue = @"kenneth@ballenegger.com";
[self->emailField setFont:boldFont];
[self->emailField setEditable:YES];
self->emailField.drawsBackground = NO;
[self->emailField setBezeled:NO];
self->emailField.textColor = [NSColor colorWithCalibratedRed:0.872 green:0.197 blue:0.228 alpha:1.000];
[self->emailField setWantsLayer:YES];
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css" />
<title>My Photo Page</title>
</head>
<body>
<table>
<thead>
<tr>
<html>
<head>
<title>Box Pricing</title>
<style>
td:nth-child(2) {
border-left:1px solid black;
}
td {
padding: 5px;
}
<!DOCTYPE html>
<html>
<head>
<title>Shannon Chang</title>
</head>
<body>
<img src=https://sphotos-b-lax.xx.fbcdn.net/hphotos-ash3/543436_10201924198617443_1291536366_n.jpg>
<p style="color:pink;font-size:26px"> About me: 22 year old female from Plano, Texas</p>
<ul style="font-family:Courier">
<li><strong>Interests:</strong> working, learning, playing, shopping, cooking, wine-tasting, gardening, and now CODING!</li>
@kballenegger
kballenegger / milene.rb
Created September 2, 2013 16:25
Fetching active campaigns by iTunes ID, using Kongo :).
# configure Kongo :)
Kongo::Collection.add_extension(:apps, Module.new do
def find_by_itunes_id(id)
find_many(itunes: id, live_notified: true)
end
self; end)
Apps = Kongo::Collection.new(:apps)
@kballenegger
kballenegger / modernizer.rb
Created August 22, 2013 22:29
This is what the DSL might look like.
Modernizer.new do
request_version { @env[...] }
first do
add 'hello' { 'hardcoded' }
end
modernize '1.2.1' do
add 'foo' { "#{@body['hello']}-bar" }
@kballenegger
kballenegger / cb_pbkdf2.c
Created August 19, 2013 19:20
PHP C modules for cb-pbkdf2.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_cb_pbkdf2.h"
#include <string.h>
#include "cb-pbkdf2.h"