Skip to content

Instantly share code, notes, and snippets.

@rastersize
rastersize / README.md
Last active May 22, 2019 21:43
Syntax highlighting of xcconfig files for Sublime Text 3

Syntax highlighting of xcconfig files for Sublime Text 3

A syntax highlighter configuration for .xcconfig (Xcode configuration) files for Sublime Text 3. Based on work by @dflems.

Screenshot of an xcconfig file being highligthed

Fig 1: Screenshot of an xcconfig file being highligthed. Shown with the “Tomorrow - Night” theme.

Installation

Copy the files *.sublime-* files into an xcconfig directory in your Packages directory.

@drumnkyle
drumnkyle / readableXIB-bookmarklet.js
Last active November 15, 2016 02:18
A helper that will take a XIB as a string and make it more human readable
var outletRegex = /<outlet property=\"(.*)\" destination=\"(.*)\" id=\".*\"\/>/g;
var xcodeIDRegex = /id=\"(.*)\".*userLabel=\"(.*)\"/g;
var customClass = /id=\"(.*)\".*customClass=\"(.*)\"/g;
var allDiffs = [].slice.call(document.getElementsByClassName("sidebyside"));
for (i = 0; i < allDiffs.length; i++) {
if (allDiffs[i].getElementsByClassName("filename-row")[0].textContent.includes(".xib")) {
var xibString = allDiffs[i].innerText;
var matches, output = [];
while (matches = outletRegex.exec(xibString)) {
@ttscoff
ttscoff / init.lua
Last active January 9, 2024 23:44
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
@andymatuschak
andymatuschak / States-v3.md
Last active May 1, 2024 12:32
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

@mchirico
mchirico / regExpOnEmoji.swift
Last active January 5, 2016 05:50
Swift 2.1+ need regex on emoji characters
/*
Was thinking there was a simplier way to do this..
"This is some text \t 🏈🏈".regex("[^ |^\t]+")
// Yields: ["This", "is", "some", "text", "🏈🏈"]
*/
import UIKit
// NSMatchingOptions(rawValue: 0)
@jellybeansoup
jellybeansoup / update-version.sh
Last active June 23, 2021 08:44
Script for Incrementing Version Numbers
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
#
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
#
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
#
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.xcode_ramdisk.agent</string>
<key>ProgramArguments</key>
<array>
<string>xcode_ramdisk.sh</string>
<string>start</string>
@hayeah
hayeah / sidekiq.rb
Created April 30, 2013 18:50
Starting sidekiq worker process using zeus for faster testing
# adapted from bin/sidekiq
# to invoke, run: zeus runner sidekiq.rb
require 'sidekiq/cli'
begin
cli = Sidekiq::CLI.instance
cli.parse
cli.run
rescue => e