Skip to content

Instantly share code, notes, and snippets.

View monkeydom's full-sized avatar

Dominik Wagner monkeydom

View GitHub Profile
@monkeydom
monkeydom / CompareMacro.h
Created August 24, 2011 10:33
Objective-C Compare Macro for your convenience
#if !defined(COMPARE)
#define COMPARE(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? NSOrderedAscending : (__a > __b ? NSOrderedDescending : NSOrderedSame); })
#endif
@monkeydom
monkeydom / applestorede.sh
Created March 24, 2011 21:02
Apple store is down script
#!/bin/bash
WaitForDown=true
while true; do
StoreUp=`curl -s http://store.apple.com/de | grep "Mac kaufen" | wc -l`
if [ $StoreUp -eq 0 ]; then
if $WaitForDown; then
@monkeydom
monkeydom / gist:881313
Created March 22, 2011 14:43
Simple Binary / List to lowercase hex functions using binary comprehensions
to_hex(List) when is_list(List) ->
to_hex(iolist_to_binary(List));
to_hex(Binary) when is_binary(Binary) ->
<< <<(to_digit(Nibble1)):8,(to_digit(Nibble2)):8>> || <<Nibble1:4,Nibble2:4>> <= Binary >>.
to_digit(N) when N < 10 -> $0 + N;
to_digit(N) -> $a + N-10.