Skip to content

Instantly share code, notes, and snippets.

View danielpunkass's full-sized avatar

Daniel Jalkut danielpunkass

View GitHub Profile
@implementation NSImage (RSShading)
- (NSImage *) tintedImage
{
NSImage* newImage = [[[NSImage alloc] initWithSize:[self size]] autorelease];
NSRect imageRect = {NSZeroPoint, [self size]};
NSColor *color = [NSColor blackColor];
[newImage lockFocus];
[[color colorWithAlphaComponent: 0.25] set];
- (void) testSimpleHTTPRequest
{
RSHTTPRequest* testViaGoogleRequest = [[RSHTTPRequest alloc] initWithURL:[self serverURLForHTTPTestNamed:@"SimpleHTTPRequest"] notifyingDelegate:self];
STAssertNotNil(testViaGoogleRequest, @"Creation of HTTP Request should have succeeded.");
[testViaGoogleRequest download];
[self spinRunLoopUntilCompletionOrTimeout];
STAssertTrue([[testViaGoogleRequest responseData] isEqualTo:[@"<hello>" dataUsingEncoding:NSUTF8StringEncoding]], @"Expected <hello> result, got %@.", [testViaGoogleRequest responseData]);
[testViaGoogleRequest release];
tell application "System Events"
tell application process "BBEdit"
tell (pop up button 1 of window 1)
-- Click to make the menu appear in the hierarchy
click
-- Now select the "Go to" item...
set goToItem to menu item "Go to…" of menu 1
click goToItem
@implementation MSFilmStripPickerScrollView
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
return YES;
}
@end
@implementation JimPopUpButtonCell
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
NSRect rect = [self drawingRectForBounds: cellFrame];
rect.size.width -= 17; // chop off the popup indicator
NSSize imageSize = NSMakeSize(12, 12);
rect.origin.x += (rect.size.width - imageSize.width) / 2.0;
- (id)copyWithZone:(NSZone *)zone
{
RSRadialProgressCell* newbie = [super copyWithZone:zone];
// When you use -[super copyWithZone], you have to assume that the superclass may have copied your instance variables over verbatim. So
// let's clear them out manually (using accessors would cause the stale pointer reference to be released).
newbie->mProgressView = nil;
newbie->mProgressView = [mProgressView retain];
newbie->mProgressCompletedOverlayImage = nil;
newbie->mProgressCompletedOverlayImage = [mProgressCompletedOverlayImage retain];
//
// TextView.m
// TextDidChange
//
// Created by Timothy J. Wood on 10/27/09.
// Copyright 2009 The Omni Group. All rights reserved.
//
/*
# Copies the selected tweet's URL from Twitter.app, and
# opens corresponding page for Aaron Swartz's Twitter Viewer.
#
# Original by John Gruber: https://gist.github.com/1440914
# This version by Daniel Jalkut
#
# I'm hooking this up to a keyboard shortcut specifically in Twitter.app,
# using my scripting utility FastScripts.
#
# Requires "Access for Assistive Devices" to be enabled.
@danielpunkass
danielpunkass / gist:2018752
Created March 11, 2012 23:57 — forked from rcw3/gist:2018059
Self-contained WWDC Status Checker Hack
#!/bin/bash
# run from terminal and you can watch it log as well... or nohup it
cd ~
testSiteForChanges ()
{
ls "old_page.html" 1>/dev/null 2>/dev/null
if [ $? -eq "1" ] ; then
/usr/local/bin/wget -q -O old_page.html $1
tell application "System Events"
set frontProcess to first process whose frontmost is true
-- When it's down to just Finder and the front process, we have to switch
-- to the Finder first to get the front process to hide itself. Furthermore,
-- the Finder will not be listed as among the visible processes unless it
-- has open windows, so treat a condition of 2 *or fewer* visible apps as
-- meaning the Finder should be activated before hiding the front process.