let re = /regex/
if "xyz" =~ /regex/ { }
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
FILES = %w( | |
drawable-hdpi/btn_star_off_disabled_focused_holo_dark.png | |
drawable-hdpi/btn_star_off_disabled_holo_dark.png | |
drawable-hdpi/btn_star_off_focused_holo_dark.png | |
drawable-hdpi/btn_star_off_normal_holo_dark.png | |
drawable-hdpi/btn_star_off_pressed_holo_dark.png | |
drawable-hdpi/btn_star_on_disabled_focused_holo_dark.png | |
drawable-hdpi/btn_star_on_disabled_holo_dark.png | |
drawable-hdpi/btn_star_on_focused_holo_dark.png | |
drawable-hdpi/btn_star_on_normal_holo_dark.png |
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
List of banned twitter usernames: | |
@account | |
@activity | |
@badges | |
@blocks | |
@bouncers | |
@contacts | |
@devices | |
@discuss |
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
### Keybase proof | |
I hereby claim: | |
* I am gurgeous on github. | |
* I am amd (https://keybase.io/amd) on keybase. | |
* I have a public key whose fingerprint is 4648 089F 413E BA29 4EB9 1128 4450 6F43 3F8E B428 | |
To claim this, I am signing this object: |
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 ruby | |
# | |
# This is a braindead objc => swift converter. It only handles a few things, | |
# but it saved me many hours of mechanical translation. The output still | |
# requires editing. | |
# | |
# Many thinsg aren't handled. Most things, in fact. Have fun! | |
# | |
# Usage: objc_to_swift.rb Somefile.m |
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
// | |
// MARK: CGPoint op point/size/float | |
// | |
func -(l: CGPoint, r: CGPoint) -> CGPoint { return CGPoint(x: l.x - r.x, y: l.y - r.y) } | |
func +(l: CGPoint, r: CGPoint) -> CGPoint { return CGPoint(x: l.x + r.x, y: l.y + r.y) } | |
func *(l: CGPoint, r: CGPoint) -> CGPoint { return CGPoint(x: l.x * r.x, y: l.y * r.y) } | |
func /(l: CGPoint, r: CGPoint) -> CGPoint { return CGPoint(x: l.x / r.x, y: l.y / r.y) } | |
func -(l: CGPoint, r: CGSize) -> CGPoint { return CGPoint(x: l.x - r.width, y: l.y - r.height) } |
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
// | |
// MARK: MKMapPoint op point/size/float | |
// | |
func -(l: MKMapPoint, r: MKMapPoint) -> MKMapPoint { return MKMapPoint(x: l.x - r.x, y: l.y - r.y) } | |
func +(l: MKMapPoint, r: MKMapPoint) -> MKMapPoint { return MKMapPoint(x: l.x + r.x, y: l.y + r.y) } | |
func *(l: MKMapPoint, r: MKMapPoint) -> MKMapPoint { return MKMapPoint(x: l.x * r.x, y: l.y * r.y) } | |
func /(l: MKMapPoint, r: MKMapPoint) -> MKMapPoint { return MKMapPoint(x: l.x / r.x, y: l.y / r.y) } | |
func -(l: MKMapPoint, r: MKMapSize) -> MKMapPoint { return MKMapPoint(x: l.x - r.width, y: l.y - r.height) } |
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
extension UIColor { | |
// | |
// MARK: create with hex string | |
// | |
convenience init(string: String) { | |
// strip leading pound | |
let s = string.stringByReplacingOccurrencesOfString("#", withString: "") | |
var r = UInt32(0) |
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 var NSDateFormatters = [ String: NSDateFormatter ]() | |
extension NSDate { | |
// | |
// MARK: today | |
// | |
// like NSDate(), but doesn't set any time components so it's always 8am. When | |
// we get dates off the wire they are always set to 8am. Having all our "dates" | |
// with identical times makes comparisons easier. |
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
class Magick::Draw | |
# Autoscale text within a box. The text will be scaled to fit if the | |
# specified pointsize is too big. If minscale is set and the text still | |
# won't fit at minscale * pointsize, it gets ellipsized. halign/valign can | |
# be used to set horizontal and vertical alignment. This is similar to the | |
# behavior of iOS UILabel. | |
def annotate_box(image:, text:, x:, y:, w:, h:, pointsize:, minscale: nil, halign: 0, valign: 0) | |
draw = self.clone | |
draw.pointsize = pointsize | |
draw.gravity = Magick::NorthWestGravity |
OlderNewer