Skip to content

Instantly share code, notes, and snippets.

View Abizern's full-sized avatar
🎧
Working from home

Abizer Nasir Abizern

🎧
Working from home
View GitHub Profile
@Abizern
Abizern / MockingTest.m
Last active January 4, 2016 14:42
Test for OCMock installation into an Xcode project.
//
// MockingTest.m
//
#import <OCMock/OCMock.h>
@interface MockingTest : XCTestCase
@end
@Abizern
Abizern / SmokeSpec.m
Created May 1, 2014 15:48
A simple test file that can be added to a project to smoke test the Specta and Expecta installation
//
// SmokeSpec.m
//
#define EXP_SHORTHAND
#import <Specta/Specta.h>
#import <Expecta/Expecta.h>
SpecBegin(SmokeTest)
@Abizern
Abizern / cookie.hs
Created April 18, 2014 09:49
Solution to Google Code Jam Q-B Cookie Cutter Alpha https://code.google.com/codejam/contest/2974486/dashboard#s=p1
@Abizern
Abizern / magic.hs
Created April 18, 2014 09:47
Solution to Google Code Jam 2014. Qualification-A Magic Trick https://code.google.com/codejam/contest/2974486/dashboard#s=p0
module Main where
import Control.Monad
import Data.List
-- https://code.google.com/codejam/contest/dashboard?c=2974486#s=p0
-- Input and output with standard redirection operators
-- Unless otherwise indicated, all modules used are either bundled with
-- the Haskell Platform (http://hackage.haskell.org/platform/) or available
@Abizern
Abizern / _gc_bare.rb
Created January 14, 2014 15:26
Recurse the current directory and run git gc on all bare repositories.
#!/usr/bin/env ruby
# A simple script that recurses through the current directory and runs
# git garbage collection on the bare repositories
Dir.glob("**/*.git") do |dir|
working_dir = File.expand_path dir
puts "#{dir} being garbage collected."
`cd #{working_dir};git gc --aggressive --prune --quiet`
end
@Abizern
Abizern / _gc_repositories.rb
Created January 14, 2014 15:23
Recurse the current directory and run git gc on all non-bare repositories.
#!/usr/bin/env ruby
# A simple script that recurses through the current directory and runs
# git garbage collection on non-bare repositories
Dir.glob("**/.git") do |dir|
working_dir = File.dirname dir
puts "#{working_dir} being garbage collected."
`cd #{File.expand_path working_dir};git gc --aggressive --prune --quiet`
end
@Abizern
Abizern / NSDictionary+JCSKeyMapping.h
Created September 10, 2013 10:55
A category method that replaces the keys in the receiver with the new key provided in the keyMapping
//
// NSDictionary+JCSKeyMapping.h
//
// Created by Abizer Nasir on 06/08/2013.
// Copyright (c) 2013 TicketingHub. All rights reserved.
//
@import Foundation;
@interface NSDictionary (JCSKeyMapping)
@Abizern
Abizern / NSDictionary+JCSKeyMapping.h
Created August 6, 2013 11:58
A category on NSDictionary that remaps the keys to new keys provided in the mapping, optionally removing null values.
//
// NSDictionary+JCSKeyMapping.h
//
// Created by Abizer Nasir on 06/08/2013.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (JCSKeyMapping)
@Abizern
Abizern / NSData+Base64.h
Created May 22, 2013 18:53
A category on NSData for base64
//
// NSData+Base64.h
// base64
//
// Created by Matt Gallagher on 2009/06/03.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software. Permission is granted to anyone to
context(@"when generating strings for uploading", ^{
it(@"should return the points as a string", ^{
NSString *pointsAsString = [_testPath pointsDataAsString];
expect([pointsAsString isKindOfClass:[NSString class]]).to.beTruthy();
});
it(@"can recreate the points from this string", ^{
NSString *pointsString = [_testPath pointsDataAsString];
NSData *pointsData = [NSData dataWithBase64EncodedString:pointsString];
expect(pointsData).to.equal(_testPath.points);