Skip to content

Instantly share code, notes, and snippets.

@shortcircuit3
shortcircuit3 / JustifiedButton.swift
Created September 29, 2016 05:09
If you're trying to position the title to the left and the icon to the right inside a UIButton
import UIKit
class WorkoutButton: UIButton {
override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
var imageFrame = super.imageRectForContentRect(contentRect)
imageFrame.origin.x = CGRectGetMaxX(contentRect) - CGRectGetWidth(imageFrame)
return imageFrame
}
@shortcircuit3
shortcircuit3 / Callback.swift
Created September 8, 2016 05:47
Working example of calbacks in swift
//: Playground - noun: a place where people can play
import UIKit
func firstFunction(input: String, completion: (result: String) -> Void) {
print("run first func")
// Need to include parameter labels in function call if
// you also use the labels in the call back definition
completion(result: "we finished!")
Dev
✔ bundle
Could not locate Gemfile or .bundle/ directory
Dev
✔ middleman init alexmilesdesign.com
/Users/alexmiles/.rbenv/versions/2.2.3/bin/middleman:23:in `load': cannot load such file -- /Users/alexmiles/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/bin/middleman (LoadError)
from /Users/alexmiles/.rbenv/versions/2.2.3/bin/middleman:23:in `<main>'
/Users/alexmiles/.rbenv/versions/2.2.3/bin/middleman:23:in `load': cannot load such file -- /Users/alexmiles/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/bin/middleman (LoadError)
from /Users/alexmiles/.rbenv/versions/2.2.3/bin/middleman:23:in `<main>'
2015-08-28T20:32:35.475275+00:00 heroku[router]: at=info method=GET path="/static/javascript/typeahead.jquery.js" host=ask-for-feedback.herokuapp.com request_id=01c3dfc6-cac2-40c5-ad6e-75c7c7ac8809 fwd="205.189.0.116" dyno=web.1 connect=15ms service=10ms status=200 bytes=63623
2015-08-28T20:32:35.415632+00:00 heroku[router]: at=info method=GET path="/static/javascript/jquery.js" host=ask-for-feedback.herokuapp.com request_id=ae913bd4-097a-4c76-8f2c-595ac2266810 fwd="205.189.0.116" dyno=web.1 connect=1ms service=39ms status=200 bytes=247840
2015-08-28T20:32:35.391538+00:00 heroku[router]: at=info method=GET path="/static/styles/css/all.css?5a292c4d" host=ask-for-feedback.herokuapp.com request_id=7eaeea10-280b-4067-8d8b-c83ee6f6939b fwd="205.189.0.116" dyno=web.1 connect=1ms service=16ms status=200 bytes=15093
2015-08-28T20:32:35.481955+00:00 heroku[router]: at=info method=GET path="/static/javascript/scripts.js" host=ask-for-feedback.herokuapp.com request_id=c56087c1-7183-442f-9099-56c84f441858 fwd="205.189.0.
@shortcircuit3
shortcircuit3 / android_assets.command
Last active August 10, 2016 12:22
Convert @1x, @1.5x, @2x, @3x assets in 'Exports' folder to Android /mdpi, /hdpi, /xhdpi, /xxhdpi file structure
#!/bin/bash
# Let's get some color going!
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
# cd into directory where the script was run
cd "$(dirname "$0")"
@shortcircuit3
shortcircuit3 / Curves.coffee
Created March 18, 2015 21:30
Framer snippit for popular easing curves
plugin.run = (contents, options) ->
"""
#{contents}
easInSine = "cubic-bezier(0.47, 0, 0.745, 0.715)"
easeOutSine = "cubic-bezier(0.39, 0.575, 0.565, 1)"
easeInOutSine = "cubic-bezier(0.445, 0.05, 0.55, 0.95)"
easeInQuad = "cubic-bezier(0.55, 0.085, 0.68, 0.53)"
easeOutQuad = "cubic-bezier(0.25, 0.46, 0.45, 0.94)"
easeInOutQuad = "cubic-bezier(0.455, 0.03, 0.515, 0.955)"
slider = (slides) ->
# Create wrapper
paginated = new Layer width: deviceWidth * slides, height: deviceHeight, x: 0
paginated.draggable.enabled = true
paginated.draggable.speedY = 0
i = 0
while i < slides
# Create views
view + i = new Layer
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
## git completion (run brew install bash-completion first)
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
## branch name in prompt
____
/\ _`\
\ \ \L\ \ __
\ \ _ <' /'__`\
\ \ \L\ \/\ __/
\ \____/\ \____\
\/___/ \/____/