Skip to content

Instantly share code, notes, and snippets.

View juanarzola's full-sized avatar

Juan Arzola juanarzola

View GitHub Profile
(*
Imports sender addresses from a Mail mailbox into AddressBook
Author: @ancientbuho
Asks you for:
- An Account and Mailbox where emails will be searched
- An Address Book Group name where the accounts will be imported (creates it if doesn't exists)
This can potentially take a long time depending your number of messages
@juanarzola
juanarzola / SHKTableViewCell.m
Created October 24, 2010 19:22
Subtle animation when changing centered-text cells to edit mode.
//
// SHKTableViewCell.m
// RIL
//
// Created by Nathan Weiner on 6/30/10.
//
// 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
@juanarzola
juanarzola / SHKTableViewCell.m
Created October 24, 2010 19:57
Using empty image to realign centered label
//
// SHKTableViewCell.m
// RIL
//
// Created by Nathan Weiner on 6/30/10.
//
// 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
@juanarzola
juanarzola / SHKTableViewCell.m
Created October 24, 2010 20:46
Centering label - updated to not show white background
//
// SHKTableViewCell.m
// RIL
//
// Created by Nathan Weiner on 6/30/10.
//
// 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
@juanarzola
juanarzola / gist:657766
Created November 1, 2010 07:15
DLog with an filename:linenumber format that Xcode's Open Quickly likes
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s <%@:%d> " fmt), __PRETTY_FUNCTION__, [[NSString stringWithFormat:@"%s", __FILE__ ] lastPathComponent] ,__LINE__, ##__VA_ARGS__)
#else
#define DLog(format, ...)
#endif
@juanarzola
juanarzola / switch-from-defines.sh
Created December 19, 2010 16:39
Generate a switch statement from a selection of #define statements. This is intended to be used within Xcode user scripts. (Make sure that "directory" is set to "home")
#!/bin/sh
echo "switch(<#expression#>){"
echo -n "%%%{PBXSelection}%%%"
awk '/#define/ {print " case "$2":{\n break;\n }"}' <&0
echo -n "%%%{PBXSelection}%%%"
echo "}"
// defines...
#define SECTION_AND_ROW_INT(section, row) (row | section << 16)
#define SECTION_AND_ROW_FOR_FIRST_NAME SECTION_AND_ROW_INT(0, 0)
#define SECTION_AND_ROW_FOR_LAST_NAME SECTION_AND_ROW_INT(0, 1)
#define SECTION_AND_ROW_FOR_AGE SECTION_AND_ROW_INT(1, 0)
// ...
// sample switch
switch (group) {
case NAME_GROUP:{
switch(row){
case FIRST_NAME_ROW:{
// do first name things
break;
}
// ...
}
break;
for(UILabel* label in self.allLabels){
[label setText:NSLocalizedString(label.text, @"")];
}
@juanarzola
juanarzola / person.js
Created October 15, 2011 18:23
Common JSON data
{
"firstName": "John",
"middleName": "M",
"lastName": "Appleseed",
"age": 30,
"addresses":[
{
"streetAddress": "222 North Mountain Rd.",
"city": "Redwood City",
"state": "CA",