This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Originally by Gordon Fontenot | |
# gordon.fontenot@me.com | |
# | |
# Log all commit messages to Day One | |
msg=`cat $PWD/.git/COMMIT_EDITMSG` | |
_pwd=`echo $PWD | sed -e "s/.*\///"` | |
_commit=`git rev-parse --short HEAD` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on alfred_script(q) | |
set {the_path, file_name} to parse_path(first item of q) | |
tell application "iTerm" | |
set _terminal to make new terminal | |
tell _terminal | |
launch session "Vim" | |
tell the last session | |
write text "cd \"" & the_path & "\"" | |
# Replace e with your vim command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_movie_duration video_file | |
# Run ffmpeg on the video, and do it silently | |
ffmpeg_output = `/usr/local/bin/ffmpeg -i "#{video_file}" 2>&1` | |
# Find the duration in the output, and force a return if it's found | |
/duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2})/i.match(ffmpeg_output) { |m| return m[1] } | |
# If it didn't get a match, something is wrong. Log the error | |
return "FFMPEG ERROR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State var showModal: Bool = false | |
var body: some View { | |
NavigationView { | |
VStack { | |
WebView(url: URL(string: "https://www.example.com")!) | |
Button("Fixme") { self.showModal = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct Sample: View { | |
var body: some View { | |
NavigationView { | |
WebView(url: URL(string: "https://example.com")!) | |
.navigationBarItems( | |
trailing: Button( | |
action: { }, | |
label: { Text("Done") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dumb value types representing UIViews. Comperable to our current models like Button.Model | |
struct StackView<Message> { | |
let children: [View<Message>] | |
} | |
struct Label { | |
let text: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func assert(_ cond: @autoclosure () -> Bool) -> String { | |
if cond() { | |
return "✅" | |
} else { | |
return "❌" | |
} | |
} | |
#if !swift(>=4.2) | |
protocol KnownEnum: RawRepresentable, Hashable where RawValue == String { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum Message<T> { | |
case value(T) | |
case finished | |
} | |
protocol Channel: IteratorProtocol { | |
func send(_ value: Message<Element>) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Safari" | |
set the_url to URL of front document | |
end tell | |
tell application "Google Chrome" | |
try | |
set win to first window | |
on error | |
set win to make new window | |
end try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
OopsieFocus | |
A script to launch OmniFocus and activate the Quick Entry Panel | |
By Shawn Blanc (http://shawnblanc.net) | |
May 20, 2011 | |
With code used from the Toggle Twitter script by Red Sweater Software: | |
http://www.red-sweater.com/blog/1646/toggle-twitter |
NewerOlder