Skip to content

Instantly share code, notes, and snippets.

View probablycorey's full-sized avatar
👯‍♂️
Dancing with my twin

Corey Johnson probablycorey

👯‍♂️
Dancing with my twin
View GitHub Profile
#!/bin/bash
set -e
cd "$(dirname $0)/.."
DIST_PATH=dist
APP_NAME=Toolbelt
APP_PATH="$DIST_PATH/$APP_NAME.app"
BACKGROUND_PNG=app/assets/install.tiff
def create
build_resource!
card = ActiveMerchant::Billing::CreditCard.new(
:number => params[:expiry_number],
:month => params[:expiry_month],
:year => params[:date_year],
:name => params[:name_on_card],
:verification_value => :params[:cvv]
)
String file contents!
local path = NSDocumentDirectory .. "/SomeDirectoryName"
local err = nil -- use err (instead of error) as the var name because error is a global lua function
if not NSFileManager:defaultManager():fileExistsAtPath(path) then
if not NSFileManager:defaultManager():fileManager:createDirectoryAtPath_withIntermediateDirectories_attributes_error(path, false, nil, err) then
puts("Create directory error %s", err:localizedDescription())
end
end
http://app.info.avid.com/e/er.aspx?elq_mid=4196&elq_cid=6541875&s=774&lid=4937&elq=d35c821242274f698fb5d7903e773409
void uncaughtExceptionHandler(NSException *e) {
NSLog(@"ERROR: Uncaught exception %@", [e description]);
lua_State *L = wax_currentLuaState();
if (L) {
wax_getStackTrace(L);
const char *stackTrace = luaL_checkstring(L, -1);
NSLog(@"%s", stackTrace);
NSString *message = [NSString stringWithFormat:@"Unexpected Exception:\n---------------------\n%@\n%s", [e description], stackTrace];
@probablycorey
probablycorey / perfect.m
Created July 28, 2011 18:25
How a property should be defined
@interface Perfect : NSObject {
@property UIView *containerView;
@property(nonatomic) UILabel *titleText;
}
local picData = toJPEG(photo):base64EncodedString()
local body = wax.http.escapeParams{pic = picData}
ImageModel:post{url, body = body, callback = function(body, response)
-- Blah Blah Blah
end}
diff --git a/lib/wax_helpers.m b/lib/wax_helpers.m
index dee91a9..f0c351d 100644
--- a/lib/wax_helpers.m
+++ b/lib/wax_helpers.m
@@ -219,7 +219,7 @@ void wax_fromInstance(lua_State *L, id instance) {
if ([instance isKindOfClass:[NSString class]]) {
lua_pushstring(L, [(NSString *)instance UTF8String]);
}
- else if ([instance isKindOfClass:[NSNumber class]]) {
+ else if ([instance isKindOfClass:[NSNumber class]] && ![instance isKindOfClass:[NSDecimalNumber class]]) lua_pushnumber(L, [instance doubleValue]);
class Global
def name; "hello world"; end
end
class ListOne < Global
def name; "one"; end
def output; "#{name}"; end
end
class ListTwo < Global