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
/** | |
Finds rotation difference between two interface orientations. | |
For example, difference between Portrait and PortraitUpsideDown is 2 (rotate by 180 degrees), | |
defference between Portrait and LandscapeLeft is 1 (rotate by 90 degrees). | |
@param source source interface orientation | |
@param destination destination interface orientation | |
@return rotation difference between orientations in range [0, 3]. | |
*/ | |
NSInteger rotationDifference(UIInterfaceOrientation source, UIInterfaceOrientation destination) { |
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
local path_string="%~" | |
local git_string='$(git_prompt_info)' | |
local prompt_string="λ" | |
local return_status="%(?:%{$fg[green]%}$prompt_string:%{$fg[red]%}$prompt_string)" | |
PROMPT="${return_status} %{$reset_color%}" | |
RPROMPT="%{$fg[yellow]%}${git_string}%{$reset_color%} ${path_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
fswatch -0 -e ".*" -i "\\.swift$" . | xargs -0 -n 1 -I {} swiftformat {} |
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
#!/usr/bin/env python | |
from subprocess import call | |
import os | |
def format_name(size, scale): | |
return str(size) + "@" + str(scale) + "x" | |
def resize(size, scale): | |
name = format_name(size, scale) |
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
/// Scrolls to the bottom of the table view, typically used to skip content. | |
/// | |
/// For precise scrolling please use `scrollToBottom(animated:)`. | |
fileprivate func initialScrollToBottom() { | |
if tableView.contentSize.height >= tableView.bounds.size.height { | |
tableView.contentOffset.y = tableView.contentSize.height - tableView.bounds.size.height | |
} | |
} | |
/// Scrolls to the bottom of the table view. |
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
private extension UIImage { | |
static func radialGradientImageWithSize(size: CGSize, outerColor: UIColor, innerColor: UIColor) -> UIImage { | |
let colorSpace = CGColorSpaceCreateDeviceRGB() | |
let gradient = CGGradientCreateWithColors(colorSpace, [outerColor.CGColor, innerColor.CGColor], [1.0, 0.0]) | |
let center = CGPoint(x: size.width / 2.0, y: size.height / 2.0) | |
UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.mainScreen().scale) | |
let imageContext = UIGraphicsGetCurrentContext() | |
CGContextDrawRadialGradient(imageContext, gradient, center, 0.0, center, size.width / 2.0, CGGradientDrawingOptions.DrawsAfterEndLocation) |
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
private extension UIColor { | |
func addedBrightness(value: CGFloat) -> UIColor { | |
var cs: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) = (0.0, 0.0, 0.0, 0.0) | |
self.getHue(&cs.hue, saturation: &cs.saturation, brightness: &cs.brightness, alpha: &cs.alpha) | |
return UIColor(hue: cs.hue, saturation: cs.saturation, brightness: cs.brightness + value, alpha: cs.alpha) | |
} | |
} |
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 Html.App | |
import Html exposing (div, Html) | |
main : Program Never | |
main = Html.App.program { init = init, view = view, update = update, subscriptions = subscriptions } | |
type alias Model = Int | |
type Msg = None |
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
<?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>name</key> | |
<string>Ascetic</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
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
FROM jimmycuadra/rust | |
MAINTAINER Aleksey Kuznetsov, zummenix@gmail.com | |
ENV CARGO_HOME /cargo | |
RUN mkdir -p "$CARGO_HOME" | |
CMD ["/bin/bash"] |
NewerOlder