Skip to content

Instantly share code, notes, and snippets.

@vinnybad
vinnybad / mergegenstrings.py
Created January 21, 2016 19:24 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
/**
* Lazily initializes an object. Mainly used for reducing boilerplate code.
*/
#define DEFINE_LAZY_GETTER(type, name, initialValueBlock) \
- (type)name { \
if (! _ ## name) { \
_ ## name = initialValueBlock(); \
} \
return _ ## name; \
}
@vinnybad
vinnybad / Fastfile
Created June 3, 2016 19:16
Shows one way to fail a build in fastlane when code coverage does not meet a minimum threshold.
#
# Shows one way to fail a build in fastlane when code
# coverage does not meet a minimum threshold.
#
# there are other ways to check the coverage of the commit,
# but I couldn't find an existing tool that makes this easier
# that will run on bitrise. I would have normally used diff-cover
# to do this because you can compare branches and only check the diffs.
# Unfortunately that means you have to find a way to install it on bitrise
# at the time of writing and that can be tricky.
#
# This is my preferred .bash_profile
#
# It has more context around git repositories, coloring, etc. Sections of this .bash_profile
# were certainly inspired by others' files (especially the git aliases).
#
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
/**
* Lazy Getter
*
* Helps reduce silly errors when writing lazy getters.
*/
#define ADD_LAZY_GETTER(type, name, initialValueBlock) \
-(type)name \
{ \
if (!_##name) { \
_##name = initialValueBlock(); \
/*
* Strongify / Weakify shortcuts
*
* These declare and instantiate weak and strong variables
* statically so it's easier to write. It's a nice middle-ground
* when compared to other solutions in the wild.
*
*/
#define WEAKIFY(aSelf) __weak typeof(aSelf) weakSelf = aSelf;
#define STRONGIFY(aSelf) __strong typeof(aSelf) strongSelf = aSelf;
/*
* Block Safety
*
* We sometimes accidentally invoke a nil block...this protects against it.
*
*/
#define SAFE_CALL(b, ...) \
if(b) b(__VA_ARGS__);
#!/bin/bash
DATESTAMP=$(date "+%Y-%m-%d-%H-%M-%S")
MOPIDY_CONFIG_DIR="$HOME/.config/mopidy"
MOPIDY_CONFIG="$MOPIDY_CONFIG_DIR/mopidy.conf"
MOPIDY_SUDOERS="/etc/sudoers.d/010_mopidy-nopasswd"
MOPIDY_DEFAULT_CONFIG="$MOPIDY_CONFIG_DIR/defaults.conf"
CONFIG_TXT="/boot/firmware/config.txt"
EXISTING_CONFIG=false
PYTHON_MAJOR_VERSION=3