Skip to content

Instantly share code, notes, and snippets.

View tobyjoe's full-sized avatar

Toby Joe Boudreaux tobyjoe

View GitHub Profile
Prominent bigrams (and their occurrence count) in the past 5000 Trump tweets as of 10PM EDT on June 19, 2019
fake news, 110
united states, 102
border security, 76
southern border, 74
witch hunt, 58
fake media, 41
news media, 40
white house, 40
@tobyjoe
tobyjoe / command_chain.go
Created December 14, 2015 16:11
Command chain pattern for waterfalling binary command sequences
package chain
type Link func() error
type Chain struct {
err error
deferred bool
Links []Link
}
### Keybase proof
I hereby claim:
* I am tobyjoe on github.
* I am tobyjoe (https://keybase.io/tobyjoe) on keybase.
* I have a public key whose fingerprint is 90B1 384E 83B5 C943 4298 64FF D307 3968 3A4D 66C3
To claim this, I am signing this object:
<?
class UserService
{
public function getUserById($id)
{
$user = null;
$user = $this->_getUserById($id); // This isn't gateway'ing. This is just class design.
return $user;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSUInteger count = [[fetchedResultsController sections] count];
if (count == 0) {
count = 1;
}
return count;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the managed object for the given index path
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
[context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];
// Save the context.
NSError *error = nil;
BOOL success = [context save:&error];