Skip to content

Instantly share code, notes, and snippets.

@hlung
hlung / roomsay.coffee
Last active December 9, 2015 19:28
Let's make Hubot say what you want in a particular room! :D
# Description:
# Let's make Hubot say what you want in a particular room! :D
#
# Dependencies:
# -
#
# Configuration:
# -
#
# Commands:
@hlung
hlung / standup.coffee
Last active December 11, 2015 04:29
Automatically nags "non-offline" people in a room at a particular time to enter something.
# 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 January 29, 2013 09:21
Returns a global unique identifier for the process.
NSString *token = [[NSProcessInfo processInfo] globallyUniqueString];
@hlung
hlung / Project-Prefix.pch
Last active December 12, 2015 01:18
Common Prefix header for all source files for most iOS projects
/*
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 June 2, 2016 07:06
Map Rails ActiveSupport timezones to iOS readable timezone IDs.
<?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 December 12, 2015 03:18
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
# 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 December 17, 2015 01:09
Save UIImage to Saved Photo Album
#import <AssetsLibrary/AssetsLibrary.h>
UIImage *image = someImage;
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:image.CGImage
orientation:(ALAssetOrientation)image.imageOrientation
completionBlock:nil];
@hlung
hlung / CGRect manipulation
Created June 3, 2013 05:10
CGRect manipulation
CGRect frame = (CGRect){
.origin.x = 60,
.origin.y = 80,
.size.width = 200,
.size.height = 300
};

| 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 March 19, 2020 08:03
Converts NSData to a hexadecimal string.
/** 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)