Skip to content

Instantly share code, notes, and snippets.

PostTableItem *pitem = [PostTableItem itemWithPost:post
dataSource:self
expanded:expanded
withBlock:nil];
pitem.urlBlock = ^{
[self.controller expandCellWithPost:post type:!expanded];
};
SECOND WAY:
CGContextRef currentContext = UIGraphicsGetCurrentContext();
if(self.selected)
{
CGColorSpaceRef colorSpace =CGColorSpaceCreateDeviceRGB();
UIColor *startColor = [UIColor fromHexString:@"222222"];
CGFloat *startColorComponents =(CGFloat *)CGColorGetComponents([startColor CGColor]);
UIColor *endColor = [UIColor fromHexString:@"444444"];
CGFloat *endColorComponents =(CGFloat *)CGColorGetComponents([endColor CGColor]);
CGFloat colorComponents[8] = {
//Parsing URLS OUT:
NSArray *comp = [self.shareView.textView.text componentsSeparatedByString:@" "];
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))" options:NSRegularExpressionCaseInsensitive error:NULL];
nonCountingChars = 0;
replaceCnt = 0;
if(comp.count)
{
[linklist removeAllObjects];
for(NSString *txt in comp)
- (NSTextCheckingResult *)linkAtPoint:(CGPoint)point
{
CGRect selfBounds = self.bounds;
static const CGFloat kVMargin = 5.0f;
if (!CGRectContainsPoint(CGRectInset(selfBounds, 0, -kVMargin), point))
{
return nil;
}
[self createTextFrame];
UIButton *peopleFilter = [UIButton buttonWithType:UIButtonTypeCustom];
peopleFilter.frame = CGRectMake(5, 3, 90, 28);
[peopleFilter setImage:[UIImage imageNamed:@"radio_button_off"] forState:UIControlStateNormal];
[peopleFilter setImage:[UIImage imageNamed:@"radio_button_on"] forState:UIControlStateSelected];
peopleFilter.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
peopleFilter.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[peopleFilter setTitle:@"PEOPLE & PLAYERS" forState:UIControlStateNormal];
peopleFilter.titleEdgeInsets = (UIEdgeInsets){2, 2, 0, 0};
peopleFilter.titleLabel.font = [UIFont fontWithName:@"Gotham-Bold" size:11];
Class (^PropertyClass)(NSMutableDictionary **);
PropertyClass = ^(NSMutableDictionary **dict){
/**
Doing stuff here
**/
return nil;
};
@kmussel
kmussel / gist:5876430
Created June 27, 2013 13:32
Neo4j backtrace LockObtainFailedException.
This happens more often when making ajax request. To fix I have to delete teh write.lock file.
Java::JavaLang::RuntimeException (org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/Users/kmussel/development/Kyck/kyck_registrar_web/db/ha_neo_1/index/lucene/node/UserData_exact/write.lock):
org.neo4j.index.impl.lucene.LuceneDataSource.newIndexWriter(LuceneDataSource.java:701)
org.neo4j.index.impl.lucene.LuceneDataSource.syncGetIndexSearcher(LuceneDataSource.java:588)
org.neo4j.index.impl.lucene.LuceneDataSource.getIndexSearcher(LuceneDataSource.java:552)
org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:268)
org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:227)
org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:238)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
(develop)$ jruby -S trinidad
Deploying from /kyck_registrar_web as /
Initializing ProtocolHandler ["http-bio-0.0.0.0-4244"]
jruby 1.7.4 (1.9.3p392) 2013-05-28 fffffff on Java HotSpot(TM) 64-Bit Server VM 1.7.0_21-b12 [darwin-x86_64]
using 1:5 runtime pool with acquire timeout of 5.0 seconds
Config HA cluster, ha.server_id: 2, db: /db/ha_neo_server_2
Connecting to database specified by database.yml
/config/initializers/devise.rb:247 warning: already initialized constant VERIFY_PEER
added application to pool, size now = 1
Starting ProtocolHandler ["http-bio-0.0.0.0-4244"]
@kmussel
kmussel / gist:8461886
Last active January 3, 2016 12:19
blueprints Add Edge
public static Object createLink(final ODocument iFromVertex,
final OIdentifiable iTo, final String iFieldName) {
final Object out;
Object found = iFromVertex.field(iFieldName);
if (found == null)
// CREATE ONLY ONE LINK
out = iTo;
else if (found instanceof OIdentifiable) {
if (found.equals(iTo))
// SAME LINK, SKIP IT
@kmussel
kmussel / gist:41bfcd17fb2e2c8f1103
Created November 14, 2014 15:14
Remote Procedure Call class with rabbitmq
require_relative 'rabbitmq.rb'
class Rpc
attr_reader :connection
attr_reader :lock, :condition
attr_accessor :response, :call_id
DEFAULT_RETRY_TIMEOUT = 60
def initialize(opts = {})