Skip to content

Instantly share code, notes, and snippets.

View say8425's full-sized avatar
๐Ÿง
We are away

Penguin say8425

๐Ÿง
We are away
View GitHub Profile
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active March 24, 2025 13:09
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@y13i
y13i / ruby_aws_sdk_credentials.md
Last active July 4, 2022 05:32
Rubyใจaws-sdkใจcredentials

ๅ‰ๆ›ธใ

AWS SDKใ‚’ไฝฟใฃใŸใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณใ‚’ไฝœใ‚‹ๆ™‚credentialsใฎๆ‰ฑใ„ใŒใ„ใคใ‚‚้ขๅ€’ใชใฎใงใ€ใƒ™ใ‚นใƒˆใƒ—ใƒฉใ‚ฏใƒ†ใ‚ฃใ‚น็š„ใชใ‚‚ใฎใ‚’่€ƒใˆใฆใ„ใใŸใ„ใ€‚

ไพ‹ใจใ—ใฆใ€

$ ruby myec2.rb list
@nacyot
nacyot / 2013-03-04-ruby-trivias-you-should-know-4.md
Last active January 21, 2025 13:36
์•Œ์•„๋‘๋ฉด ๋„์›€์ด ๋˜๋Š” 55๊ฐ€์ง€ ๋ฃจ๋น„ ๊ธฐ๋ฒ•

์•Œ์•„๋‘๋ฉด ๋„์›€์ด ๋˜๋Š” 55๊ฐ€์ง€ ๋ฃจ๋น„ ๊ธฐ๋ฒ•

Ruby๋Š” ์ฆ๊ฑฐ์šด ์–ธ์–ด์ž…๋‹ˆ๋‹ค. Ruby๋ฅผ ์‚ฌ์šฉํ•˜๋‹ค๋ณด๋ฉด ๋งค๋‰ด์–ผ์—๋„ ๋‚˜์™€์žˆ์ง€ ์•Š์€ '์ž‘์€ ๋ฐœ๊ฒฌ'์„ ๋งŒ๋‚˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ '๋ฐœ๊ฒฌ'์€ ํ”„๋กœ๊ทธ๋žจ์˜ ์งˆ์ด๋‚˜

@bunnymatic
bunnymatic / nested_content_snippet.rb
Created December 6, 2012 08:28
nested content in rails view helpers
# 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')
@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
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;