Skip to content

Instantly share code, notes, and snippets.

View hectr's full-sized avatar

Hèctor M. R. hectr

  • Barcelona, Spain
View GitHub Profile
@hectr
hectr / iPhone 5s
Last active January 1, 2017 18:38
Opens iPhone simulator.
#! /bin/bash
################################################################################
#
# Opens in iPhone simulator named after this file (e.g. if you want the iPhone 5
# simulator, rename this file to "iPhone 5").
#
# Examples:
#
# Usage without parameters: ./iPhone\ 5s
@hectr
hectr / git-conflict
Last active January 1, 2017 18:33
Checks if a branch can be automatically merged into current branch.
#!/bin/bash
# branch
################################################################################
#
# Checks if a branch can be automatically merged into current branch.
#
# Example:
# ./git conflict develop
#
@hectr
hectr / git-cdc
Created January 1, 2017 18:31
Changes author and commit dates of a commit.
#!/bin/bash
# commit
# date YYYY-mm-dd HH:MM:SS
################################################################################
#
# Changes author and commit dates of a commit.
#
# Warning:
# For OS X you may also install GNU coreutils (brew install coreutils), add it
@hectr
hectr / MRManagedObjectContext.h
Created August 20, 2015 00:33
Core Data stack with read-only main context
// Copyright (c) 2013, Héctor Marqués
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// Copyright (c) 2015, Héctor Marqués
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
@hectr
hectr / NSObject+mr_mock_method.h
Last active August 29, 2015 14:27
Mock Objective-C method with a block
// Copyright (c) 2015, Héctor Marqués
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM