Skip to content

Instantly share code, notes, and snippets.

Set username
git config --global user.name "Your Name Here"

Set e-mail
git config --global user.email "your_email@example.com"

Clorize and make git output pretty
git config --global color.ui true

Creating a repository

# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
@bleeckerj
bleeckerj / mongo-java-driver: LazyDBObjectTest.java
Created January 29, 2014 17:42
Unit Test of LazyDBObject in Mongo API showing example of how to use it
/**
* Copyright (C) 2008 10gen Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
Usage
NSString *password = @"1111";
NSString *message = @"xxx";
NSData *inData = [message dataUsingEncoding:NSUTF8StringEncoding];
NSData *encData = [securityUtils encryptPBEWithMD5AndDESData:inData password:password];
NSString *encString = [encData base64EncodedString];
@synthesize firstName = _firstName;
@synthesize txtFirstName = _txtFirstName;
[RACAbleSelf(self.firstName) subscribeNext:^(id x) { [self firstNameChanged:x]; }];
[self rac_bind:RAC_KEYPATH_SELF(self.firstName) to:self.txtFirstName.rac_textSubscribable];
- (void) firstNameChanged:(id)firstName {
NSLog(@"changed: %@", firstName);
}
@bleeckerj
bleeckerj / NSMutableDictionary+JCBDictionaryTimedCache.h
Last active August 29, 2015 14:02
NSMutableDictionary that acts like a very stoopid simple timed cache and can optionally notify you when something is removed.
//
// NSMutableDictionary+JCBDictionaryTimedCache.h
//
//
// Created by Julian Bleecker on 6/8/14.
//
//
#import <Foundation/Foundation.h>
typedef void(^NotifyHandler)(id<NSCopying>aKey);
@bleeckerj
bleeckerj / MASExampleScrollViewDynamicContentViewSize
Created June 24, 2014 22:28
Animate the size and layout of UIViews within a UIScrollview. This shows how to use Masonry/AutoLayout to have a UIScrollView with subviews in its content view that can dynamically change their size/layout
//
// Created by Julian Bleecker on June 22, 2014.
// Copyright (c) 2014 Julian Bleecker. All rights reserved.
//
#import "MASExampleScrollViewDynamicContentViewSize.h"
/**
*
* This shows how to use Masonry/AutoLayout to have a UIScrollView with
@bleeckerj
bleeckerj / CATransform3D
Created June 30, 2014 02:34
Gist for CATransform3D for iCarousel to give a "deck of cards" style transformation
- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform
{
if (offset > 0)
{
//move back
transform = CATransform3DTranslate(transform, 0, 0, -50 * offset);
}
else
{
//flip around
@bleeckerj
bleeckerj / UILabel+withDate.h
Created July 7, 2014 05:06
A UILabel category that can represent dates relative to now in a human-readable way. It's more sensitive to recent events as it refers to long away events in years, with no months or other finer grained date-y representations.
//
// UILabel+withDate.h
// Humans
//
// Created by julian on 12/27/12.
// Copyright (c) 2012 nearfuturelaboratory. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController ()
@property (strong, nonatomic) UIScrollView* vScrollView;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];