This file contains hidden or 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
r1 = 1.0 | |
r2 = 0.95 | |
g1 = 1.0 | |
g2 = 1.0 | |
b1 = 0.2 | |
b2 = 0.1 | |
# Euclidean distance |
This file contains hidden or 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
# ================================= | |
# = Warped shadow for any CGLayer = | |
# ================================= | |
def warpShadow(rect, offset) | |
size = rect.size | |
path = UIBezierPath.bezierPath | |
# Top/Right: ````| | |
path.moveToPoint([offset, offset]) | |
path.addLineToPoint([size.width - offset, offset]) |
This file contains hidden or 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
validate :unique_organisation_entry | |
def unique_organisation_entry | |
matched_entry = Organisation.where(['LOWER(name) = LOWER(?) AND LOWER(company_no) = LOWER(?) AND LOWER(postcode) = LOWER(?)', self.name, self.company_no, self.postcode]).first | |
errors.add(:base, 'I know you think you\'re clever, but someone already submitted that one.') if matched_entry && (matched_entry.id != self.id) | |
end |
This file contains hidden or 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
### Show stack trace for 500 errors | |
### (adapted from https://gist.github.com/1079020) | |
# Given an application, yield to a block to handle exceptions | |
class ExceptionRaiserApp | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
This file contains hidden or 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 IndexController < UITableViewController | |
def init | |
super.tap do | |
self.tabBarItem = UITabBarItem.alloc.initWithTitle('Index', rmq.image.resource('home'), tag: 1) | |
self.title = 'Index' | |
end | |
end | |
end |
This file contains hidden or 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
Rails.cache.fetch("cached_tweet", expires_in: 1.hour) do | |
Timeout::timeout(5) do |
This file contains hidden or 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
[36mBuilt-in Atom packages[39m (84) | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] |
This file contains hidden or 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
iex(1)> Tmdb.Movie.popular | |
[page: 1, | |
results: [%{"adult" => false, | |
"backdrop_path" => "/xu9zaAevzQ5nnrsXN6JcahLnG4i.jpg", "id" => 157336, | |
"original_title" => "Interstellar", "popularity" => 34.1716910628099, | |
"poster_path" => "/nBNZadXqJSdt05SHLqgT0HuC5Gm.jpg", |
This file contains hidden or 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
iex(1)> Tmdb.Movie.popular[:results] | |
[%{"adult" => false, "backdrop_path" => "/xu9zaAevzQ5nnrsXN6JcahLnG4i.jpg", | |
"id" => 157336, "original_title" => "Interstellar", | |
"popularity" => 34.1716910628099, | |
"poster_path" => "/nBNZadXqJSdt05SHLqgT0HuC5Gm.jpg", | |
"release_date" => "2014-11-05", "title" => "Interstellar", "video" => false, | |
"vote_average" => 8.5, "vote_count" => 2009}, | |
%{"adult" => false, "backdrop_path" => "/c1OSRvorPXvGtFka7mgV6Jcw6jd.jpg", | |
"id" => 168259, "original_title" => "Furious 7", | |
"popularity" => 29.8393594653136, |
This file contains hidden or 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
You can configure git to push to the current branch using the following command | |
git config --global push.default current | |
then just do | |
git push | |
this will push the code to your current branch. |
OlderNewer