Skip to content

Instantly share code, notes, and snippets.

View hlship's full-sized avatar

Howard M. Lewis Ship hlship

View GitHub Profile
[paneLayer setImage:[[CPImage alloc] initWithContentsOfFile:@"Resources/sample.jpg"
size:CGSizeMake(500, 430)]];
@import <AppKit/CPPanel.j>
@import <AppKit/CPView.j>
@implementation PhotoPanel : CPPanel
{
CPArray images;
}
- (id)init
{
<target name="compile" description="Compile Clojure sources.">
<mkdir dir="${classes.dir}" />
<!-- Seek out the namespaces to compile. Note that this will fail if the actual name of a package includes an underscore, as
all underscores are converted to dashes. -->
<pathconvert pathsep=" " property="compile.namespaces">
<fileset dir="${src.dir}" includes="**/*.clj" />
<chainedmapper>
<packagemapper from="${basedir}/${src.dir}/*.clj" to="*" />
<filtermapper>
@hlship
hlship / Clojure compile Ant snippet
Created July 21, 2009 15:20
Allows all .clj files to be located and compiled
<target name="compile" description="Compile Clojure sources.">
<mkdir dir="${classes.dir}" />
<!-- Seek out the namespaces to compile. Note that this will fail if the actual name of a package includes an underscore, as
all underscores are converted to dashes. -->
<pathconvert pathsep=" " property="compile.namespaces">
<fileset dir="${src.dir}" includes="**/*.clj" />
<chainedmapper>
<packagemapper from="${basedir}/${src.dir}/*.clj" to="*" />
<filtermapper>
- (id)init
{
self = [super init];
_panel = [[CPPanel alloc] initWithContentRect:CGRectMake(20, 30, 245, 184)
styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
[_panel setTitle:@"Twitter"];
[_panel setMinSize:CGSizeMake(245, 184)];
@import <AppKit/CPView.j>
@import <AppKit/CPTextField.j>
@implementation TwitView : CPView
{
CPTextField _label;
}
- (id)initWithFrame:(CGRect)frame
{
- (void)updateTimeline:(CPArray) timeline
{
var width = CPRectGetWidth([_timelineView bounds]) - 4;
var count = [timeline count];
for (row = 0; row < count; row++)
{
var frame = CGRectMake(2, 64 * row + 2, width, 60);
var view = [[TwitView alloc] initWithFrame:frame forStatus:[timeline objectAtIndex:row]];
public static void contributeValueEncoderSource(
MappedConfiguration<Class, ValueEncoderFactory> configuration,
final Session session)
{
ValueEncoder<Posting> postingValueEncoder = new ValueEncoder<Posting>()
{
@Override
public String toClient(Posting value)
@hlship
hlship / DateField time zone aware parsing
Created December 8, 2010 20:01
Selection from DateField component that handles parsing the date string to the user's time zone
// Regardless of the timeZone set on the DateFormat, the value is parsed in
// the current default TimeZone. Use the calendar to adjust it out.
Date inDefaultTimeZone = format.parse(value);
Calendar c = Calendar.getInstance(locale);
c.setTime(inDefaultTimeZone);
TimeZone clientZone = timeZoneTracker.getClientTimeZone();
TimeZone defaultZone = TimeZone.getDefault();
@hlship
hlship / gist:1225415
Created September 18, 2011 19:05
Cascade defrecord example
(defrecord Comment [text]
NodeStreaming
(stream [node strategy out]
(write out "<!--" text "-->")))