Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
Ruby๋ ์ฆ๊ฑฐ์ด ์ธ์ด์ ๋๋ค. Ruby๋ฅผ ์ฌ์ฉํ๋ค๋ณด๋ฉด ๋งค๋ด์ผ์๋ ๋์์์ง ์์ '์์ ๋ฐ๊ฒฌ'์ ๋ง๋๊ฒ ๋ฉ๋๋ค. ์ด๋ฌํ '๋ฐ๊ฒฌ'์ ํ๋ก๊ทธ๋จ์ ์ง์ด๋
# because i can never remember exactly how and when to use concat | |
# when building content in helpers | |
def nested_content | |
content_tag 'div' do | |
concat(content_tag 'span', 'span block') | |
concat(tag 'br') | |
concat(link_to 'root link', root_path) | |
concat(tag 'br') | |
concat(link_to('#') do | |
concat(content_tag 'h2', 'Head \'em off') |
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
// UIImage+Alpha.h | |
// Created by Trevor Harmon on 9/20/09. | |
// Free for personal or commercial use, with or without modification. | |
// No warranty is expressed or implied. | |
// Helper methods for adding an alpha layer to an image | |
@interface UIImage (Alpha) | |
- (BOOL)hasAlpha; | |
- (UIImage *)imageWithAlpha; | |
- (UIImage *)transparentBorderImage:(NSUInteger)borderSize; |