Skip to content

Instantly share code, notes, and snippets.

@carlossless
carlossless / rotating-image-frames-from-imageview.m
Last active August 29, 2015 13:57
Create PNG Animation Frame Images by Animating an UIImageView
- (void)makeRotatedImagesWithImageView:(UIImageView *)imageView
{
for (int i = 0; i < 30; i++) {
CGFloat angle = M_PI / 15 * i;
CGSize boundingSize = imageView.image.size;
boundingSize.width *= 2;
boundingSize.height *= 2;
@carlossless
carlossless / regenerate-models-xcode.sh
Created April 11, 2015 10:14
Data and Resource Model Regeneration Xcode scripts
PATH=/usr/local/bin/:${PATH}
if command -v mogenerator >/dev/null 2>&1; then
mogenerator --v2 --model "$SRCROOT"/TeamApp/Database/TeamApp.xcdatamodeld --human-dir "$SRCROOT"/TeamApp/Database/Models --machine-dir "$SRCROOT"/TeamApp/Database/Models/Generated
else
echo "warning: You have to install and set up mogenerator to generate the data models"
fi
PATH=/usr/local/bin/:${PATH}
if command -v xcres >/dev/null 2>&1; then
xcres --no-ansi build "$PROJECT_FILE_PATH" "$SRCROOT"/TeamApp/Resources/R
@carlossless
carlossless / ModuleA.swift
Last active November 19, 2015 15:11
Linker Failure when assigning a protocol with a getter for a struct property in a different framework
import Foundation
import ModuleB
public protocol CacheableConfiguration: Decodable {
static var fileName: String { get }
var version: Int { get } // this is what is triggering the linker fail
func object() -> AnyObject
}
@carlossless
carlossless / generate-changelog.sh
Created November 24, 2015 09:29
A script to parse a given range of the current git repo log, find Jira issue Ids and print out links to them
#!/bin/bash
COMMIT_RANGE=$TRAVIS_COMMIT_RANGE
JIRA_ISSUE_PREFIX="VI-"
JIRA_ISSUE_BASE_URL="https://mycompany.atlassian.net/browse/"
if [ -z "$COMMIT_RANGE" ]; then >&2 echo "Commit Range is Empty. Exiting."; exit 0; fi
GIT_LOG=`git log --pretty=format:'%h %ad %s | %an' --date=short "$COMMIT_RANGE" | grep -v Merge | sed -E 's/.{7} (.*)/\1/g'`

Keybase proof

I hereby claim:

  • I am carlossless on github.
  • I am carlossless (https://keybase.io/carlossless) on keybase.
  • I have a public key ASDIyuZFuUxZrqPFmPDfiqKO-TZGi4cp6eKiKWJIKYzJ1Qo

To claim this, I am signing this object:

@carlossless
carlossless / uninstall-cocoapods.sh
Last active April 8, 2016 09:53
Uninstall All Versions of CocoaPods and Dependencies
#!/bin/bash
gem uninstall cocoapods -a -x
gem uninstall cocoapods-core -a
gem uninstall cocoapods-deintegrate -a
gem uninstall cocoapods-downloader -a
gem uninstall cocoapods-plugins -a
gem uninstall cocoapods-search -a
gem uninstall cocoapods-stats -a
gem uninstall cocoapods-trunk -a
@carlossless
carlossless / post-commit-global-log.sh
Created September 26, 2016 19:38
A script to log the last commit message to the users shared git log
#!/bin/bash
# A script to log the last commit message to the users shared git log
# Useful to keep track of what you did durring a specific day
LOG_PATH="$HOME/gitlogs"
DATE=`date +'%Y-%m-%d'`
COMMIT=`git log --color --graph --pretty=format:'%h %s' -1 HEAD`
REPO_PATH=`git rev-parse --show-toplevel`
REPO_NAME=`basename "$REPO_PATH"`
@carlossless
carlossless / monty-hall.c
Last active March 29, 2017 13:48
A statistical simulation of the Monty Hall problem.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int rand_lim(int limit);
int try_game();
int main ()
{
srand(time(NULL));
@carlossless
carlossless / UncurryBuilder.swift
Created June 18, 2017 12:12
A little Swift 4.0 script to build uncurry functions for https://github.com/carlossless/Uncurry
import Foundation
var chars = "ABCDEFGHIJKLMNOPQRSTU"
let charStrings = chars.characters
.map{ String($0) }
func buildFunc(charStrings: [String], index: Int) -> String {
let lowerCaseChars = charStrings.map { $0.lowercased() }
let upperCaseChars = charStrings.map { $0.uppercased() }
@carlossless
carlossless / check_instrumentation.sh
Created September 14, 2017 14:12
Check Carthage dependency binaries for LLVM Instrumentation symbols
#!/usr/bin/env bash
FRAMEWORK_BINARIES=$(find . -path "./Carthage/Build/*.framework/*" -type f -maxdepth 5 ! -name "*.*")
check_framework () {
printf "Checking $1..."
if OTOOL_OUTPUT=$(otool -l -arch all "$1" | grep __llvm_prf) ; then
printf " LLVM instrumentation symbols found:\n"
printf "$OTOOL_OUTPUT\n\n"
else