Skip to content

Instantly share code, notes, and snippets.

View MarcoSero's full-sized avatar

Marco Sero MarcoSero

View GitHub Profile
@MarcoSero
MarcoSero / camel and snake case.hs
Created August 25, 2014 10:41
Haskell case additions
separatedWords :: String -> [String]
separatedWords = filter (not . any isSpace) . groupBy ((==) `on` isSpace)
toCamel :: String -> String
toCamel = foldl (\acc x -> acc ++ [(if null acc then (head x) else (toUpper $ head x))] ++ (tail x)) [] . separatedWords . map (toLower)
toSnake :: String -> String
toSnake = foldr (\x acc -> x ++ (if null acc then "" else "_") ++ acc) [] . separatedWords . map (toLower)

iTerm2

http://www.iterm2.com/#/section/downloads

Get the iTerm color settings

https://raw.github.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors

Apply them in iTerm through iTerm -> preferences -> profiles -> load presets -> import. You can create a different profile, other than Default if you wish to do so.

Description

Dashing widget to display a Jenkins build status and build progress

The widget is based on the meter-widget which is default in the Dashing installation

The widget can also see the progress of a "pre-build", i.e if you have a job triggering the actual build you want to define, you can configure this job in the jenkins_build.rb as a prebuild.

For more information, please see Coding Like a tosser

@MarcoSero
MarcoSero / 0_reuse_code.js
Created January 30, 2014 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MarcoSero
MarcoSero / .gitignore
Created September 30, 2013 10:13
.gitignore file for Xcode 4/5
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.1
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
# - added line-by-line explanations for EVERYTHING (some were missing)
#
@MarcoSero
MarcoSero / Nimble.podspec
Last active December 23, 2015 20:39
Nimble Podspec
Pod::Spec.new do |s|
s.name = "Nimble"
s.version = "0.0.1"
s.summary = "Core Data and iCloud made nimble and fast."
s.homepage = "http://github.com/MarcoSero/Nimble"
s.license = 'MIT'
s.author = { "Marco Sero" => "marco@marcosero.com" }
s.source = { :git => "https://github.com/MarcoSero/Nimble.git", :tag => "0.0.1" }
s.platform = :ios, '5.0'
s.source_files = 'Nimble/*.{h,m}', 'Nimble/**/*.{h,m}'
#define ms_invoke_block_if_not_nil(BLOCK, ...) if ((BLOCK)) {(BLOCK)(__VA_ARGS__);}
// Usage:
void (^block)(id, id, id) = void(^)(id parameter1, id parameter2, id parameter3) {
// ...
};
ms_invoke_block_if_not_nil(block, parameter1, parameter2, parameter3);
// As opposed to:
@MarcoSero
MarcoSero / gist:5787782
Created June 15, 2013 11:15
Class Dump iOS 7 Frameworks
# install class-dump
brew install class-dump
# dump the frameworks you're interested in
class-dump -H -o UIKit /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework
class-dump -H -o SpringBoardUI /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks/SpringBoardUI.framework
@MarcoSero
MarcoSero / foo.m
Created April 20, 2013 12:57 — forked from ryancole/foo.m
Convert NSPredicate into NSDictionary for use as a query string in an AFNetworking HTTP request
- (NSURLRequest *)requestForFetchRequest:(NSFetchRequest *)fetchRequest
withContext:(NSManagedObjectContext *)context {
// init the query string dictionary
NSMutableDictionary *queryString = nil;
// if we're given a predicate, convert it to a dictionary
if (fetchRequest.predicate) {
if ([fetchRequest.predicate isKindOfClass:[NSCompoundPredicate class]]) {
@MarcoSero
MarcoSero / HashFunctions.m
Created October 1, 2012 11:33
Objective-C Hash Functions
+ (NSString*) sha1:(NSString*)input
{
const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:input.length];
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(data.bytes, data.length, digest);
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];