Skip to content

Instantly share code, notes, and snippets.

@zwaldowski
zwaldowski / Activity.swift
Last active November 3, 2024 17:37
os_activity_t for Swift 3
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {
@dealforest
dealforest / slack.py
Last active January 24, 2018 01:53
send to slack in LLDB
#!/usr/bin/env python
import lldb
def slack(debugger, command, result, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
path = command
lldb.debugger.HandleCommand("""
expr -l swift --
@Lutzifer
Lutzifer / replaceNSlocalized.sh
Last active September 18, 2018 15:13
Automatically replace NSLocalizedString(...) in Swift with corresponding tr(...) calls for https://github.com/AliSoftware/SwiftGen. Copy both into the project and call 'sh replaceNSlocalized.sh'
#/bin/sh
# Run this inside the project to replace NSLocalizedString calls with swiftgen calls in all .swift files.
# Do not forget to make a backup before.
find . -type f | grep ".swift" > swiftindex.temp
while IFS= read -r filename
do
grep -o "NSLocalizedString(\"[^\")]*\", comment:\s*\"\")" "$filename" > strings.temp
@rizumita
rizumita / BundleSegue.swift
Last active March 9, 2016 15:32
Using UIStoryboardSegue for purposes of injecting dependencies and passing data
class BundleSegue: ConfigurationSegue {
typealias Source = BundlesViewController
typealias Destination = BundleViewController
typealias First = BundlesViewController
typealias Second = BundleViewController
override func inject() {
destinationController.viewModel = resolver.resolve(BundleViewModelType.self)
#!/usr/bin/env bash
# Automatically installs swiftenv and run's swiftenv install.
# This script was designed for usage in CI systems.
git clone --depth 1 https://github.com/kylef/swiftenv.git ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then
swiftenv install -s
//
// Signal+Extensions.swift
// Khan Academy
//
// Created by Nacho Soto on 10/1/15.
// Copyright © 2015 Khan Academy. All rights reserved.
//
import ReactiveCocoa
@skoji
skoji / remove-slack-settings.sh
Created November 2, 2015 03:34
remove Slack settings (OS X)
rm -rf ~/Library/Application\ Support/Slack/
rm -rf ~/Library/Containers/com.tinyspeck.slackmacgap/
rm -rf ~/Library/Preferences/com.tinyspeck.slackmacgap.plist
rm -rf ~/Library/Saved\ Application\ State/com.tinyspeck.slackmacgap.savedState
rm ~/Library/Safari/LocalStorage/*slack*
@akramhussein
akramhussein / CrashlyticsLogger.swift
Created August 11, 2015 15:07
CocoaLumberjack Custom Crashlytics Logger in Swift
import Foundation
import CocoaLumberjack
import Crashlytics
class CrashlyticsLogger : DDAbstractLogger
{
static let sharedInstance = CrashlyticsLogger()
private var _logFormatter : DDLogFormatter?
override var logFormatter: DDLogFormatter? {
@vsouza
vsouza / .bashrc
Last active September 21, 2024 12:31
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@haranicle
haranicle / AppStoreScreenShotMaker.sh
Last active June 21, 2020 19:57
A shell script to create AppStore screen shots.
#!/bin/sh
# settings ==========
# src file name
fileNamePrefix="ScreenShotFileNameFor5.5inch"
offsetFor3_5=20
# dest directory name