Skip to content

Instantly share code, notes, and snippets.

View AndrewDongminYoo's full-sized avatar
🐈
My cat is interfering

Dongmin,Yu AndrewDongminYoo

🐈
My cat is interfering
View GitHub Profile
@AndrewDongminYoo
AndrewDongminYoo / case_converter.dart
Created October 17, 2024 04:44
Dart extension methods for applying camelCase and snake_case to strings
extension StringExtensions on String {
/// 문자열을 스네이크 케이스로 변환하는 `toSnakeCase()` 메서드를 사용하여 [String] 클래스를 확장
///
/// 스네이크 케이스는 단어는 밑줄(`_`)로 구분하고 모든 문자는 소문자로 구분하는 명명 규칙입니다.
/// 이 메서드는 문자열의 문자를 반복하여 문자열의 시작 부분에 없는 대문자 앞에 밑줄을 추가하고 모든 문자를 소문자로 변환
///
/// Example:
/// ```dart
/// 'HelloWorld'.toSnakeCase(); // 'hello_world'
/// 'XMLHTTPRequest'.toSnakeCase(); // 'xmlhttp_request'
@AndrewDongminYoo
AndrewDongminYoo / ruby-version.sh
Last active March 14, 2023 01:48
MacOS에서의 루비버전 셋팅. rbenv와 homebrew를 설치하지 않았다면 다운받은 후에, 이 스크립트를 ".bash_profile", ".zshrc", ".config/fish/config.fish" 등에 불여넣으시면 됩니다. CLI 커맨드로는 `tail -n +3 ruby-version.sh >> ~/.zshrc` 하면 끝!
#!/bin/bash
# this function will check if .ruby-version file exists
function set_ruby() {
if [ -f ".ruby-version" ]; then
version=$(cat .ruby-version)
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
brew_ruby=$("$HOMEBREW_PREFIX/opt/ruby/bin/ruby" --version)
if [[ $brew_ruby =~ $version ]]; then
echo "💎 now using homebrew version ($version) of Ruby."