Skip to content

Instantly share code, notes, and snippets.

@haikusw
haikusw / DropBox-info.plist
Created June 30, 2011 05:06
Dropbox 1.4.2 info.plist Document types possibly too broad?
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>All Files</string>
<key>LSItemContentTypes</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
@haikusw
haikusw / gist:1098966
Created July 22, 2011 06:09
for Oxceed
de_CH: "CHF" (should be "Fr.")
fr_CH: "CHF" (should be "fr.")
it_CH: "CHF" (should be "fr.")
rm_CH: "CHF" (should be "fr.")
international: "USD" (should be "CHF")
#import "AFRestClient+OAuth.h"
NSString * const kAFOAuthBasicGrantType = @"user_basic";
NSString * const kAFOauthRefreshGrantType = @"refresh_token";
@implementation AFRestClient (OAuth)
- (void)authenticateUsingOAuthWithPath:(NSString *)path
username:(NSString *)username
password:(NSString *)password
@haikusw
haikusw / makeunivstaticlib.sh
Created November 21, 2011 19:41
Run Script build phase script to make a universal static library.
#!/bin/sh
# makeuniversalstaticlib.sh
# SAMPLELib
#
#################[ Tests: helps workaround any future bugs in Xcode ]########
DEBUG_THIS_SCRIPT="false"
@haikusw
haikusw / buildAndPackageOneConfig.sh
Created November 21, 2011 19:48
Builds one config (Debug, Release, or Dist)
#Xcode target has sub-targets of the resources bundle target, and the target that makes a universal version of the static library for the current build config).
#this is the Run Script build phase that happens after that.
echo ""
echo "moving resources bundle into universal build folder"
echo ""
if [ ${ACTION} = "build" ]
then
echo "Copying resources into ${BUILD_DIR}/${CONFIGURATION}-universal/ ..."
@haikusw
haikusw / main.m
Created December 29, 2011 03:59
Some odd bug in dictionary description ...
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
#define kItemKey @"kItemKey"
#define kPriceKey @"kPriceKey"
@autoreleasepool {
// insert code here...
@haikusw
haikusw / HUTF8MappedUTF16String.h
Created February 3, 2012 22:26 — forked from rsms/HUTF8MappedUTF16String.h
Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity range and index lookups
#ifndef H_UTF8_MAPPED_UTF16_STRING_H_
#define H_UTF8_MAPPED_UTF16_STRING_H_
#import <Foundation/Foundation.h>
#import <string>
/*
* Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity
* range and index lookups.
*
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@haikusw
haikusw / gist:3290457
Created August 7, 2012 23:19
some snippets of a routine to create a dynamically drawn on 2d texture in unity
Dynamic drawing to a texture in Unity3d basic. This is not complete working code but pieces cut out of working code so you'll have to look up the documentation for the functions called to get specific parameters and such.
static function CreateFooTexture ( ... )
{
// create texture:
var tex : Texture2D = new Texture2D(512, 512, TextureFormat.ARGB32, false);
// get the pixels
@haikusw
haikusw / NSObject+RFExtensions.h
Created October 8, 2012 06:35 — forked from bsneed/NSObject+RFExtensions.h
perform a block in a background thread, and call a completion block on the main thread when its done.
//
// NSObject+RFExtensions.h
//
// Created by brandon on 10/5/12.
// Copyright (c) 2012 redf.net. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^NSObjectPerformBlock)(id userObject);