> s = 'abc/d/efg/h'
> s.count('/')
3
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
print "hello world" |
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
# create a new subscription | |
customer.subscriptions.create(plan='basic') | |
# delete a subscription | |
customer.subscriptions.retrieve(subscription_id).delete() | |
# update a subscription | |
subscription = customer.subscriptions.retrieve(subscription_id) | |
subscription.trial_end = modified_trial_end | |
subscription.plan = subscription.plan.id # if possible, change API to make this superfluous. |
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/bash | |
# get frontmost app | |
frontmost_app=$(osascript -e ' | |
tell application "System Events" | |
POSIX path of (file of application processes whose frontmost is true and visible is true) | |
end tell | |
') | |
escaped_frontmost_app=${frontmost_app//\//\\/} |