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
shopt -s extglob | |
if [ ! -e $BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME ]; then | |
LUADIR="$SRCROOT/luajit" | |
mkdir -p $BUILT_PRODUCTS_DIR | |
for ARCH in $ARCHS ; do | |
TARGET_ARCH="-m32" |
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 <Foundation/Foundation.h> | |
static NSMethodSignature *BlockSignature(id blockObj) { | |
struct Block { | |
void *isa; | |
int flags; | |
int reserved; | |
void *invoke; |
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 <dlfcn.h> | |
#import <Foundation/Foundation.h> | |
struct BlockDescriptor | |
{ | |
unsigned long reserved; | |
unsigned long size; | |
void *rest[1]; |
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 gist uses http://luapower.com/objc.html as an FFI. I think it works on it's own, but I would recommend | |
-- getting the whole LuaPower project, because all the libraries rock. | |
-- | |
-- This script will open a window that displays two rectangles. One red and one blue. | |
local glue = require'glue' | |
local objc = require'objc' | |
local ffi = require'ffi' | |
local pp = require'pp' |
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 <Foundation/Foundation.h> | |
#import <objc/message.h> | |
struct BlockDescriptor { | |
unsigned long reserved; | |
unsigned long size; | |
void *rest[1]; | |
}; | |
struct Block { |
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
property lastSleepLength : 5 | |
property fade_for_minutes : 10 | |
global endTime, initialVolume | |
on idle | |
-- Wait until fade_for_minutes before the end time | |
-- Then call fade_sound which will fade the sound, pause itunes, and reset the volume | |
set curTime to current date | |
if ((curTime + (fade_for_minutes * 60)) ≥ endTime) then |
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
#keep code within THEDEFINITION defines | |
unifdef -DTHEDEFINITION in.c > out.c | |
#remove code within THEDEFINITION defines | |
unifdef -UTHEDEFINITION in.c > out.c |
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
curl -b cookies.txt -c cookies.txt <URL> -o <output file> -L -C - |
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
#!/bin/bash | |
if [[ ! "$1" || "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP | |
Resample specified images to 72 DPI | |
http://benalman.com/ | |
Usage: $(basename "$0") [img [img ...]] | |
The new MacBook Pro retina display is amazing, but screengrabs taken on | |
one using the screencapture utility aren't scaled to 72 DPI by default. | |
This script scales those images to 72 DPI, making them viewable at a sane | |
resolution in web browsers. |
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
# Decompress files from EPUB e-book | |
unzip epubfilename.epub | |
# Compress back to EBUB e-ebook | |
zip -X newepubname.epub mimetype | |
zip -rg newepubname.epub META-INF -x \*.DS_Store | |
zip -rg newepubname.epub OEBPS -x \*.DS_Store |