This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conf = { | |
"sqs-access-key": "", | |
"sqs-secret-key": "", | |
"sqs-queue-name": "", | |
"sqs-region": "us-east-1", | |
"sqs-path": "sqssend" | |
} | |
import boto.sqs | |
conn = boto.sqs.connect_to_region( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIView *PSPDFFindFirstResponderBeneathView(UIView *view) { | |
// Stop if e.g. we show an UIAlertView with a text field. | |
if (UIApplication.sharedApplication.keyWindow != view.window) return nil; | |
// Search recursively for first responder. | |
for (UIView *childView in view.subviews) { | |
if ([childView respondsToSelector:@selector(isFirstResponder)] && childView.isFirstResponder) return childView; | |
UIView *result = PSPDFFindFirstResponderBeneathView(childView); | |
if (result) return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Do *not* load any libs here that are *not* part of Ruby’s standard-lib. Ever. | |
desc "Install all dependencies" | |
task :bootstrap do | |
if system('which bundle') | |
sh "bundle install" | |
sh "git submodule update --init" | |
# etc | |
else | |
$stderr.puts "\033[0;31m[!] Please install the bundler gem manually: $ [sudo] gem install bundler\e[0m" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation CIContext (IntermediateImage) | |
- (CIImage *)rsq_renderToIntermediateImage:(CIImage *)image { | |
CIImage *intermediateImage = nil; | |
CGSize size = image.extent.size; | |
CVPixelBufferRef pixelBuffer = NULL; | |
CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, | |
size.width, | |
size.height, | |
kCVPixelFormatType_32ARGB, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is a simple example of "scrolling" form with ncurses. | |
* It use "page" to allow forms with more fields than your window can print. | |
* | |
* It prints a "label" (inactive field) and a regular field and let you | |
* "scroll" pages of the form. | |
* | |
* How to compile: | |
* gcc -o test scrolling_form.c -lform -lncurses | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GinkgoGames::SinglePlayerLevel::onQuit() { | |
// Achievement check begins | |
rbx = *(rdi + 0x70); // rbx = ID of current scenario | |
rax = GIN::Symbolize("sp_forst_destructor"); // rax = representation of scenario "sp_forst_destructor" | |
if (rbx == rax) { // check if we are in scenario "sp_forst_destructor" | |
rax = GIN::Node::getPropertyValue( | |
GIN::Node::find(GIN::Symbolize("destructionDirector")), // destructionDirector is the unavoidable mechanism | |
"Capacitor", // that starts once all 8 shards are plugged in | |
"killCounter", | |
"charge", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Observes a run loop to detect any stalling or blocking that occurs. | |
/// | |
/// This class is thread-safe. | |
@interface GHRunLoopWatchdog : NSObject | |
/// Initializes the receiver to watch the specified run loop, using a default | |
/// stalling threshold. | |
- (id)initWithRunLoop:(CFRunLoopRef)runLoop; | |
/// Initializes the receiver to detect when the specified run loop blocks for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class GeneralThing<S> { | |
var stuff: S? | |
func doIt() { | |
if let s = stuff { | |
doWithStuff(s) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//If you have a Bridging-Header: | |
#import <FBSDKCoreKit/FBSDKCoreKit.h> | |
#import <FBSDKLoginKit/FBSDKLoginKit.h> | |
//In your AppDelegate: | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [String: AnyObject]?) -> Bool { | |
//App launch code | |
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) | |
//Optionally add to ensure your credentials are valid: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plistlib | |
# Read Plists | |
myAppInfoPlist = plistlib.readPlist(“MyApp/Info.plist”) | |
watchKitExtensionInfoPlist = plistlib.readPlist(“WatchKitExtension/Info.plist”) | |
watchKitAppInfoPlist = plistlib.readPlist(“WatchKitApp/Info.plist”) | |
# Update Watch Kit Extension Plist | |
watchKitExtensionInfoPlist[“NSExtension”][“NSExtensionAttributes”][“WKAppBundleIdentifier”] = watchKitAppInfoPlist[“CFBundleIdentifier”] | |
watchKitExtensionInfoPlist[“CFBundleVersion”] = myAppInfoPlist[“CFBundleVersion”] |