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
// 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;
@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
@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')
@nacyot
nacyot / 2013-03-04-ruby-trivias-you-should-know-4.md
Last active January 21, 2025 13:36
์•Œ์•„๋‘๋ฉด ๋„์›€์ด ๋˜๋Š” 55๊ฐ€์ง€ ๋ฃจ๋น„ ๊ธฐ๋ฒ•

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

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

@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
@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.

@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 12, 2025 21:24
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@davidderus
davidderus / .dockerignore
Last active March 3, 2024 10:15
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
@redism
redism / kr_won_to_backquote.sh
Created April 26, 2017 16:20
macOS Sierra์—์„œ ์›ํ™”(โ‚ฉ) ๋Œ€์‹  ๋ฐฑ ์ฟผํŠธ(`) ์ž…๋ ฅํ•˜๊ธฐ
#!/bin/bash
if [ -f ~/Library/KeyBindings/DefaultkeyBinding.dict ]; then
echo "~/Library/KeyBindings/DefaultkeyBinding.dict already exists"
exit -1
fi
mkdir -p ~/Library/KeyBindings
cat << EOF > ~/Library/KeyBindings/DefaultkeyBinding.dict
{
"โ‚ฉ" = ("insertText:", "\`");
@duluca
duluca / awc-ecs-access-to-aws-efs.md
Last active February 5, 2025 13:59
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide: