Skip to content

Instantly share code, notes, and snippets.

View jaminguy's full-sized avatar

Jamin Guy jaminguy

View GitHub Profile
- (NSString *)localPathForRecording:(RecordingFileInfo *)recording {
return [[RecordingController recordingsPath] stringByAppendingPathComponent:recording.fileName];
}
actions.each do |action|
action[:bundleID] = bundle_id
action[:applicationVersion] = application_version
action[:deviceID] = device_id
action[:osVersion] = os_version
action[:hardwareVersion] = hardware_version
action[:deviceID] = device_id
end
@jaminguy
jaminguy / gist:1092835
Created July 19, 2011 15:45
Dalli Sinatra Test
get '/dalli_test' do
some_var = settings.cache.get('some_var')
if(some_var == nil)
"some_var is nil: #{some_var}\n"
settings.cache.set('some_var', 'some_value')
else
"some_var is not nil: #{some_var}\n"
end
end
- (void)configureScoreDescriptionText {
if(kloutUser.kscoreDescription) {
CTTextAlignment kAlignment = kCTLeftTextAlignment;
CGFloat lineSpacing = 1.0;
CTParagraphStyleSetting paragraphSettings[] = {
{ kCTParagraphStyleSpecifierAlignment, sizeof(kAlignment), &kAlignment},
{ kCTParagraphStyleSpecifierLineSpacing, sizeof(lineSpacing), &lineSpacing}
};
NSMutableDictionary *stringAttributes = [NSMutableDictionary dictionary];
CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(paragraphSettings, sizeof(paragraphSettings));
{
"match_policy": "include_any",
"clauses": [
{
"operator": "one_of",
"field": "/data/entities/mentions/*/id",
"object_type": "post",
"value": [
"5952",
"26215",
def on_receive(self, response_chunk):
self.response_object += str(response_chunk).strip()
if response_chunk.endswith("\r\n") and self.response_object.strip():
try:
adn_object = self.response_object.strip()
self.publish_message(adn_object)
except Exception as e:
text = "on_receive error {}".format(e)
print text
log.error(text)
@jaminguy
jaminguy / gist:5266853
Created March 28, 2013 21:13
Header dump from an AFNetwork get call from iOS to http://httpecho.heroku.com/headers.json
[
[
"HTTP_ACCEPT",
"*/*"
],
[
"HTTP_HOST",
"httpecho.heroku.com"
],
[
robocopy "C:\Users\Public\Public Games" "D:\Backup\Games" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Desktop" "D:\Backup\Jamin\Desktop" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Downloads" "D:\Backup\Jamin\Downloads" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Documents" "D:\Backup\Jamin\Documents" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Music" "D:\Backup\Jamin\Music" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Pictures" "D:\Backup\Jamin\Pictures" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\Videos" "D:\Backup\Jamin\Videos" /S /Z /PURGE /R:5 /W:5 /V
robocopy "C:\Users\Jamin\AppData" "D:\Backup\Jamin\AppData" /S /Z /PURGE /R:5 /W:5 /V
pause
#pragma mark - NSFetchedResultsControllerDelegate methods
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
[self.tableView beginUpdates];
}
- (void)controller:(NSFetchedResultsController *)controller
didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath
forChangeType:(NSFetchedResultsChangeType)type
@jaminguy
jaminguy / gist:2ca497affc41c4150dc5
Created May 20, 2014 15:03
Load a view from a nib in almost one line
+ (instancetype)newInstance {
id newInstance = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
return [newInstance isKindOfClass:[self class]] ? newInstance : nil;
}