Skip to content

Instantly share code, notes, and snippets.

cbertoldi / Bash cheat sheet
Last active Dec 15, 2015
Some bash reminders. Copied here before the original file disappears :)
View Bash cheat sheet
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command <' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
cbertoldi / Receive
Created Oct 31, 2012
Problem with JMS transactions
View Receive
public void receive() {
TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
Message msg = jmsTemplate.receive(queue);
boolean success = false;
if (msg != null) {
try {
success = handleMessage(msg);
if (success) {
msg.acknowledge(); // session is still open within the transaction
cbertoldi / gist:1498279
Created Dec 19, 2011
How to parse a JSON string using RestKit, without loading a remote resource
View gist:1498279
NSString *jsonString = [self readJSON:@"some_file"];
NSDictionary *dictionary = [jsonString objectFromJSONString];
RKObjectMapper *mapper = [RKObjectMapper mapperWithObject:dictionary
mappingProvider:[MappingFactory sharedMappingProvider]];
RKObjectMappingResult *result = [mapper performMapping];
// MappingFactory
+ (RKObjectMappingProvider *)sharedMappingProvider
View setUp
- (void)setUp
[super setUp];
RKObjectManager *objectManager = [RKObjectManager
[RKObjectManager setSharedManager:objectManager];
// [RKObjectManager sharedManager].objectStore = [RKManagedObjectStore objectStoreInMemory];
RKManagedObjectStore *objectStore = [RKManagedObjectStore objectStoreInMemory];
View restkit_coredata_problem.m
// in the app delegate
RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURL:@""];
RKManagedObjectStore *objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"TestJSON.sqlite"];
[objectManager setObjectStore:objectStore];
// following is called within a view
if (self) {
cbertoldi / Desert 256.dvtcolortheme
Created Oct 6, 2011
256 colors desert color scheme for xCode
View Desert 256.dvtcolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>0.000 0.000 0.000 1</string>
<string>Inconsolata - 14pt</string>
<string>0.000 0.000 0.000 1</string>