Skip to content

Instantly share code, notes, and snippets.

@jamztang
jamztang / UIApplicationAddition.h
Last active October 5, 2015 18:29
Handy marco to return supported UIInterfaceOrientation for your View Controllers
// Created by Jamz Tang 2012-06-02
// http://ioscodesnippet.com/post/24203288551/quickly-switch-supported-uiinterfaceorientation-for
// Convert UIInterfaceOrientation to NSString, so we can compare it
static inline NSString *NSStringFromUIInterfaceOrientation(UIInterfaceOrientation orientation) {
switch (orientation) {
case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait";
case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown";
case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft";
case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight";
@stuartcarnie
stuartcarnie / UIAlertView_BlocksExtension.h
Created February 20, 2012 05:49
UIAlertView block extension
#import <UIKit/UIKit.h>
@interface UIAlertView (BlocksExtension)<UIAlertViewDelegate>
+ (id)alertViewWithTitle:(NSString *)title message:(NSString *)message completionBlock:(void (^)(NSUInteger buttonIndex))block cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
@end
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
#!/bin/bash
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
CATALINA_HOME=/Users/username/tomcat
function shutdown() {
date
echo "Shutting down Tomcat"
$CATALINA_HOME/bin/catalina.sh stop