Skip to content

Instantly share code, notes, and snippets.

View rgm's full-sized avatar

Ryan McCuaig rgm

View GitHub Profile
# see http://blog.jayfields.com/2007/08/ruby-calling-methods-of-specific.html
module Kernel
def as(ancestor, &blk)
@__as ||= {}
unless r = @__as[ancestor]
r = (@__as[ancestor] = As.new(self, ancestor))
end
r.instance_eval(&blk) if block_given?
r
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER'); require 'logger'; RAILS_DEFAULT_LOGGER = Logger.new(STDOUT); end
class TemporaryBasicAuth
def initialize(app)
@app = Rack::Auth::Basic.new(app) do |username,password|
(username == 'someguy') and (password == 'mypassword')
end
@app.realm = "Your realm here"
end
def call(env)
return @app.call(env)
end
while [[ 1 ]]; do
curl -s http://developer.apple.com/iphone | grep -i "comebacksoon" > /dev/null
if [[ $? == 0 ]]; then
echo 'down'
else
say 'THE DEVELOPER SITE IS UP'
echo 'up'
break
fi
sleep 120
# thanks to @chockenberry for concept
while [[ 1 ]]; do
curl -s http://developer.apple.com/wwdc/ | grep "<title>" | grep "2009" > /dev/null
if [[ $? == 0 ]]; then
say 'Apple has not yet announced w.w.d.c. 2010'
echo 'not announced'
else
say 'w.w.d.c. 2010 has just been announced!'
echo 'announced!'
break
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
@rgm
rgm / gist:774995
Created January 11, 2011 19:48
XCode 4 DP6 error
=== BUILD NATIVE TARGET aoTitleblock OF PROJECT aoTitleblock WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
2011-01-11 11:39:10.218 xcodebuild[82304:3907] ASSERTION FAILURE in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-214/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/TargetSnapshots/BuildPhaseTypes/XCRezBuildPhaseDGSnapshot.m:70
Details: refArray should be an instance inheriting from XCBuildFileRefArrayDGSnapshot, but it is nil
Object: <XCRezBuildPhaseDGSnapshot: 0x20034c4e0>
Method: -computeDependenciesForFilePath:ofType:forBuildFileReference:usingBuildRule:inTargetBuildContext:
Thread: <NSThread: 0x2005353a0>{name = (null), num = 3}
Backtrace:
0 0x0000000100c3e3ae -[PBXTargetBuildContext(DependencyGraphEvents) handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DevToolsCore)
1 0x000000010002f409 _DVTAssertionFailureHandler (in DVTFoundation)
#ifndef AO_UTILITIES
#define AO_UTILITIES
#define DEBUGLOG(s,...) NSLog((@"%s:%d " s), __func__, __LINE__, ## __VA_ARGS__)
#include <MiniCadCallBacks.h>
#include <VWFCLibrary.h>
enum TagType {
kEverywhereTagType,
@rgm
rgm / ModuleMain.cpp
Created March 31, 2011 20:48
Boilerplate module entry point for Vectorworks SDK work
#include "Menu.h"
#include "Parametric.h"
#include "Tool.h"
#define REGISTER(x) REGISTER_Extension<x::Definition>(GROUPID_Extension##x, action, pInfo, ioData, cbp, reply)
extern "C" long GS_EXTERNAL_ENTRY plugin_main(long action,
void *pInfo,
long &ioData,
CallBackPtr cbp)
@rgm
rgm / Prefix.cpp
Created April 1, 2011 20:58
Boilerplate prefix header for Vectorworks SDK projects
#ifdef _DEBUG
#include <GSBug.h>
#define _DEBUG_MEMORY
#define _DO_TIMING
#else
#include <GSRELEASE.h>
#endif
// order matters here; don't re-sort
#include <MCCoordTypes.h>