Skip to content

Instantly share code, notes, and snippets.

View muncman's full-sized avatar

Kevin Munc muncman

View GitHub Profile
@phil-blain
phil-blain / .gitattributes
Last active October 28, 2024 22:38
Git pickaxe : show only relevant hunks (filter displayed hunks using the given search string)
*.md diff=markdown
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 18, 2024 07:43
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
import Foundation
let session = NSURLSession.sharedSession()
let requestIsBeingHandledKey = "RequestIsBeingHandledKey"
class CustomNSURLProtocol: NSURLProtocol {
override class func canInitWithRequest(request: NSURLRequest) -> Bool {
if NSURLProtocol.propertyForKey(requestIsBeingHandledKey, inRequest: request) != nil {
return false // Prevent recursize loop
@AlejandroJL
AlejandroJL / Configuration.md
Last active February 26, 2022 23:55
Xcode 5 automatic TestFlight build uploading and ready for Xcode Server CI Bots.
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active October 25, 2024 16:26
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@sjmadsen
sjmadsen / increment-build-counter.rb
Created July 18, 2012 13:38
Automatic Git revision stamping for Xcode projects
# Xcode auto-versioning script for Git by Steve Madsen.
# Adapted from Subversion script by Axel Andersson.
#
# This is a Ruby script. Use /usr/bin/ruby as the shell.
build_counter_file = 'build-counter'
raise "#{$0}: Must be run from Xcode" unless ENV['BUILT_PRODUCTS_DIR']
def development?
# This is part of a rakefile I use for UI Automation that's part of an
# upcoming (secret) project that I hope to announce soon.
# You need to set the $app_bundle global variable to point to the application's
# bundle on disk. Then hand in 1 for iPhone or 2 for iPad to this function
# and it will manipulate the plist of the device.
def pick_simulator_device index
# For now, the only way to tell UI Automation to run the iPad or iPhone
# simulator is to change the app bundle plist to require only that device.
@alexvollmer
alexvollmer / run-test-script
Created April 11, 2012 23:25
Wrapper script for running UIAutomation from the command-line
#!/usr/bin/env ruby -wKU
require "fileutils"
require "pty"
unless ARGV.length == 3
STDERR.puts "USAGE: run-test-script <app bundle> <test script> <output directory>"
exit 1
end
@johnbintz
johnbintz / gist:1809410
Created February 12, 2012 16:15
For the lazy, how to Guard::Guard your own Guard
# Guardfile
require 'guard/guard'
class ::Guard::JohnIsAwesome < ::Guard::Guard
def start
puts "Whoa a guard."
end
def run_all
" Use arrow keys to move buffers
map <up> <C-w>k<cr>
map <down> <C-w>j<cr>
map <left> <C-w>h<cr>
map <right> <C-w>l<cr>