Skip to content

Instantly share code, notes, and snippets.

@Jberlinsky
Jberlinsky / gist:10655822
Created April 14, 2014 14:59
keybase.md
### Keybase proof
I hereby claim:
* I am jberlinsky on github.
* I am jrb (https://keybase.io/jrb) on keybase.
* I have a public key whose fingerprint is 36F8 C5B6 50EF CDE7 144A D9B2 7B34 A287 F191 47FC
To claim this, I am signing this object:
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@Jberlinsky
Jberlinsky / gist:64e4cbeca33d65470120
Created December 21, 2014 04:56
Null Object Pattern Example
class NullNumber
def +(other)
raise ArgumentError
end
def to_i
raise ArgumentError
end
end
Verifying I am +jberlinsky on my passcard. https://onename.com/jberlinsky
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
[searchBar resignFirstResponder];
NSLog(@"Search Text: %@",[searchBar text]);
[self startSearchingWithText:[searchBar text]];
}
- (void) startSearchingWithText:(NSString *)text {
...
// Go through the list of services and set up a query for the search term
QueryServiceManager *manager = [[QueryServiceManager alloc] initWithServices: services];
(gdb) continue 2010-02-26 18:43:32.515 iSave[11690:207] ( "Toshiba Satellite L505-GS5037 TruBrite 15.6-Inch Laptop (Black)", "Dell Inspiron 11 11.6-Inch Obsidian Black Laptop (Windows 7 Premium)", "ASUS Eee PC Seashell 1005PE-MU17-BK 10.1-Inch Black Netbook - Up to 11 Hours of Battery Life", "SwissGear Computer Backpack (Red)", "Belkin 36-Piece Demagnatized Computer Tool Kit with Case (Black)", "Compaq EVO N610C", "Belkin F8E062 55-Piece Computer Tool Kit with Black Case (Demagnetized Tools)", "ASUS Eee PC Seashell 1005PE-PU17-BK 10.1-Inch Black Netbook - Up to 14 Hours of Battery Life", "Harman Kardon SoundSticks II 2.1 Plug and Play Multimedia Speaker System", "ION Audio VCR 2 PC USB VHS Video to Computer Converter" )
(gdb) continue
Program received signal: “EXC_BAD_ACCESS”.
(gdb)
def format_time(time_str,timezone_str):
try:
tz = pytz.timezone(timezone_str)
except UnknownTimeZoneError:
tz = pytz.utc
dt = datetime.fromtimestamp(time_str)
localized_time = tz.localize(dt)
return localized_time.strftime("%l:%M ")
CommonPlace git:(master) ✗ rake routes | grep update_new ▸▸▸▸▸▸▸▸▸▸
update_new_account PUT /account/update_new(.:format) {:controller=>"accounts", :action=>"update_new"}
GET /account/update_new(.:format) {:controller=>"accounts", :action=>"update_new"}
def create_interaction(self, client_key, client_secret, subdomain,
48 visitor_email, chat_description, visitor_name, subject='',
49 case_id=None):
50
51 if visitor_name == '':
52 visitor_name = 'Olark Visitor'
53
54 if visitor_email == '':
55 cust_id = self.create_lead(client_key, client_secret, subdomain,
56 visitor_email, visitor_name.replace(",",""))