Skip to content

Instantly share code, notes, and snippets.

View pigfly's full-sized avatar
:octocat:
AFK

Alyx pigfly

:octocat:
AFK
View GitHub Profile
class CustomButton: UIButton {
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
let newPoint = self.layer.presentationLayer()!.convertPoint(point, fromLayer: layer)
return super.hitTest(newPoint, withEvent: event)
}
}
demoView.frame = CGRectMake(0, 0, 100, 100)
demoView.backgroundColor = UIColor.purpleColor()
self.backgroundColor = UIColor.greenColor()
UIView.animateWithDuration(3, delay: 0, options: [.CurveLinear, .AllowUserInteraction],
animations: { () -> Void in
self.backgroundColor = UIColor.grayColor()
self.demoView.center = CGPointMake(200, 200)
}) { (Bool) -> Void in
@pigfly
pigfly / core_animation_demo_1.swift
Created March 29, 2016 23:51
Gist for my post core animation explained
demoView.frame = CGRectMake(0, 0, 100, 100)
demoView.backgroundColor = UIColor.purpleColor()
self.backgroundColor = UIColor.greenColor()
UIView.animateWithDuration(5.0) { () -> Void in
self.backgroundColor = UIColor.grayColor()
self.demoView.center = CGPointMake(100, 100)
}
puts("foo bar")
@pigfly
pigfly / create_users.rb
Last active August 29, 2015 14:22
Gist for my post "Rails: Model and Its Associated Testing"
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.timestamps null: false
end
end
end
@pigfly
pigfly / deploy.sh
Last active August 8, 2023 02:18
Octopress cheat sheet
# commit
git add --all
git commit -m "commit message"
# only run this for first time deploy
rake setup_github_pages
# deploy
rake generate && rake deploy
@pigfly
pigfly / article.html
Last active August 29, 2015 14:22
Gist for my post "Fix date not get rendered after upgrade octopress"
<h5 class="date-time">{% include post/date.html %}<i class="icon-calendar"></i> {{ time }}</h5>