Skip to content

Instantly share code, notes, and snippets.

@hlung
hlung / roomsay.coffee
Last active Dec 9, 2015
Let's make Hubot say what you want in a particular room! :D
View roomsay.coffee
# Description:
# Let's make Hubot say what you want in a particular room! :D
#
# Dependencies:
# -
#
# Configuration:
# -
#
# Commands:
@hlung
hlung / standup.coffee
Last active Dec 11, 2015
Automatically nags "non-offline" people in a room at a particular time to enter something.
View standup.coffee
# Description:
# Automatically nags "non-offline" people in a room at a particular time interval to enter something.
#
# Dependencies:
# cron, time, node-xmpp
#
# Configuration:
# HIPCHAT_STANDUP_ROOM_JID e.g. '13184_botlab@conf.hipchat.com'
# HIPCHAT_STANDUP_TIMEZONE e.g. "Asia/Bangkok" or "Europe/Paris" or "America/New_York"
# HIPCHAT_STANDUP_CRON_TIME e.g. '0 0 14-18 * * 1-5' means weekdays, every hour from 2-6PM
@hlung
hlung / gist:4662942
Created Jan 29, 2013
Returns a global unique identifier for the process.
View gist:4662942
NSString *token = [[NSProcessInfo processInfo] globallyUniqueString];
@hlung
hlung / Project-Prefix.pch
Last active Dec 12, 2015
Common Prefix header for all source files for most iOS projects
View Project-Prefix.pch
/*
Copyright (C) 2013 by Thongchai Kolyutsakul
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@hlung
hlung / ActiveSupport_to_iOS_timezones.plist
Last active Jun 2, 2016
Map Rails ActiveSupport timezones to iOS readable timezone IDs.
View ActiveSupport_to_iOS_timezones.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Information</key>
<dict>
<key>Description</key>
<string>Map Rails ActiveSupport timezones to iOS readable timezone IDs.</string>
<key>Version</key>
<string>1.0</string>
@hlung
hlung / ios-sim xcode run script
Last active Dec 12, 2015
A bash script to put in Xcode's "Run Script" build phrase to make xcodebuild able to run logic tests - to make automated testing possible. It will launch app using ios-sim and set up environment to inject test bundle into application. Source: http://stackoverflow.com/a/12682617/504494
View ios-sim xcode run script
# A bash script to put in Xcode's "Run Script" build phrase to make xcodebuild able to run logic tests - to make automated testing possible.
# It will launch app using ios-sim and set up environment to inject test bundle into application.
# Source: http://stackoverflow.com/a/12682617/504494
# Dependencies:
# - ios-sim (https://github.com/phonegap/ios-sim)
# Usage:
# - create a new test target in the project
# - go to Edit Scheme... > Build tick "Run" next to your test target
@hlung
hlung / gist:5526038
Last active Dec 17, 2015
Save UIImage to Saved Photo Album
View gist:5526038
#import <AssetsLibrary/AssetsLibrary.h>
UIImage *image = someImage;
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:image.CGImage
orientation:(ALAssetOrientation)image.imageOrientation
completionBlock:nil];
View CGRect manipulation
CGRect frame = (CGRect){
.origin.x = 60,
.origin.y = 80,
.size.width = 200,
.size.height = 300
};
View App Presets.md

| No | Sadly | There is none |

| Except this, which is a poor alternative |

| There really | should be one |

| Tables | Are | Cool |

@hlung
hlung / iOS - NSData+hexadecimalString.m
Last active Mar 19, 2020
Converts NSData to a hexadecimal string.
View iOS - NSData+hexadecimalString.m
/** Converts NSData to a hexadecimal string. */
@interface NSData (NSData_hexadecimalString)
/** Changes NSData object to a hex string.
@returns hexadecimal string of NSData. Empty string if data is empty.*/
- (NSString *)hexadecimalString;
@end
@implementation NSData (NSData_hexadecimalString)