Skip to content

Instantly share code, notes, and snippets.

View troystribling's full-sized avatar

Troy Stribling troystribling

  • San Francisco, CA
View GitHub Profile
@troystribling
troystribling / eeprom_objects.h
Created March 23, 2014 17:06
Simple CRUD for storing objects using Arduino EEPROM library.
#include <EEPROM.h>
#include <Arduino.h>
#include "log.h"
template <class T> class EEPROMObject {
public:
EEPROMObject(uint16_t _offset, uint8_t _maxObjects) : offset(_offset), maxObjects(_maxObjects){};
uint16_t create(uint8_t& index, const T& value);
uint16_t update(uint8_t index, const T& value);
uint16_t read(uint8_t index, T& value);
@troystribling
troystribling / post-commit
Last active December 21, 2015 02:18
lolcommits .git/hooks/post-commit running zsh and rvm
#!/bin/zsh
source "$HOME/.rvm/scripts/rvm"
lolcommits --capture
@troystribling
troystribling / scala.vim
Created June 15, 2013 22:37
Fix for synatstic flagging local imports as errors. in file .vim/janus/vim/tools/syntastic/syntax_checkers/scala.vim
1 "============================================================================
2 "File: scala.vim
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Rickey Visinski <rickeyvisinski at gmail dot com>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
10 "
@troystribling
troystribling / RememberMeAuthStrategy.scala
Last active January 1, 2017 08:32
Scalatra 2.2 Sentry implemented for username/password and cookie authentication.
package lib
import org.scalatra._
import org.scalatra.util.RicherString._
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.scalatra.auth.{ScentrySupport, ScentryStrategy}
import net.iharder.Base64
import java.util.Locale
import io.Codec
@troystribling
troystribling / DataManager.h
Created November 19, 2012 03:12
Simple Core Data wrapper. Supports background access.
#import <Foundation/Foundation.h>
#import "NSManagedObject+DataManager.h"
@interface DataManager : NSObject
@property (nonatomic, strong, readonly) NSManagedObjectModel* managedObjectModel;
@property (nonatomic, strong, readonly) NSManagedObjectContext* managedObjectContext;
@property (nonatomic, strong, readonly) NSPersistentStoreCoordinator* persistentStoreCoordinator;
@property (nonatomic, strong) NSURL* modelURL;
@property (nonatomic, strong) NSString* persistantStoreName;
@troystribling
troystribling / gist:2941424
Created June 16, 2012 14:10
GPUImage Blending Mode example
- (UIImage*)blendedImage {
GPUImagePicture* bluredImage = [[GPUImagePicture alloc] initWithImage:self.filterImage];
GPUImageFilterGroup* blurFilterGroup = [[GPUImageFilterGroup alloc] init];
GPUImageFilter* colorOverlayfilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"WhiteColorOverlay"];
GPUImageGaussianBlurFilter* gaussainBlur = [[GPUImageGaussianBlurFilter alloc] init];
[gaussainBlur setBlurSize:3.0f];
[blurFilterGroup addFilter:colorOverlayfilter];
[blurFilterGroup addFilter:gaussainBlur];
@troystribling
troystribling / gist:2936763
Created June 15, 2012 14:33
Set Title of Terminal Window
function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }
@troystribling
troystribling / UIImage+Extensions.h
Created May 28, 2012 00:18
Blank UIImage with Specified Color
#import <Foundation/Foundation.h>
@interface UIImage (Extensions)
+ (UIImage*)blankImage:(CGSize)_size;
+ (UIImage*)blankImage:(CGSize)_size withColor:(UIColor*)_color;
@end
@troystribling
troystribling / ParameterSliderView.h
Created May 26, 2012 22:11
UIPanGesture Slider Control
#import <UIKit/UIKit.h>
@protocol ParameterSliderViewDelegate;
@interface ParameterSliderView : UIView
@property(nonatomic, weak) id<ParameterSliderViewDelegate> delegate;
@property(nonatomic, strong) UIView* parameterView;
@property(nonatomic, strong) UIView* parameterViewBorder;
@property(nonatomic, strong) UIPanGestureRecognizer* panGesture;
@troystribling
troystribling / gist:2603949
Created May 5, 2012 16:47
Load UIView from NIB
#import "NSObject+Extensions.h"
@interface UIView (Extensions)
+ (UIView*)loadView:(Class)_viewClass;
@end
@implementation UIView (Extensions)