Skip to content

Instantly share code, notes, and snippets.

View flavono123's full-sized avatar
🐶
Doggy days

Hansuk Hong flavono123

🐶
Doggy days
View GitHub Profile
@joongimin
joongimin / git-rebranch
Last active January 23, 2019 03:50
git-rebranch
#!/usr/bin/env ruby
def run_and_echo(cmd)
puts cmd
result = system(cmd)
raise "FAIL - `#{cmd}`" unless result
end
max_steps = ARGV[0].to_i
begin
@joongimin
joongimin / ch9-simplifying-conditional-expressions.md
Last active January 23, 2019 14:11
ch9-simplifying-conditional-expressions

Ch#9 Simplifying Conditional Expressions

Decomponse Conditional

  • condition check 와 action 양쪽 모두 코드로 되어 있으면 읽기 어렵다.

  • 이를 method로 추출한다.

/*! debug.css | MIT License | zaydek.github.com/debug.css */
*:not(path):not(g) {
color: hsla(210, 100%, 100%, 0.9) !important;
background: hsla(210, 100%, 50%, 0.5) !important;
outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important;
box-shadow: none !important;
}
@joongimin
joongimin / github_pr_reviewer_bookmarklet.js
Created June 1, 2018 08:03
github_pr_reviewer_bookmarklet.js
javascript:(
function() {
ids = ['2058928', '17093928', '8577077', '20619567', '38043493'];
form = document.querySelector('form[action*=review-requests]');
ids.forEach(function(id){ var input = document.createElement('input');
input.setAttribute('name', 'reviewer_user_ids[]');
input.setAttribute('value', id);
form.appendChild(input);
});
event = document.createEvent("HTMLEvents");
@flavono123
flavono123 / accounts_forms.py
Last active February 2, 2018 08:03
A tricky way of Django auth; 'Username as Email' with default user model(django.contrib.auth.models.User)
# accounts/forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm, get_user_model
class SignupForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
fields = UserCreationForm.Meta.fields + ('email',)
widgets = {
'username': forms.EmailInput(attrs={
@WaKeMaTTa
WaKeMaTTa / order-rails-controller-callbacks.md
Last active July 29, 2019 12:29
Order of Rails Controller Callbacks

Order of Rails Controller Callbacks

Rails 4.x

Started GET "/" for 127.0.0.1 at 2017-05-19 14:17:18 +0200
  Processing by WelcomeController#index as HTML
    prepend_around_action
    prepend_before_action
 before_action
@waylandzhang
waylandzhang / aws.md
Created December 27, 2016 07:10 — forked from colinvh/aws.md
AWS Region Names

Alternative naming schemes for AWS regions

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Schemes

@colinvh
colinvh / aws.md
Last active April 6, 2026 10:15
AWS Region Names

Alternative naming schemes for AWS regions

Incorporates changes by 0mnius.

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Legend

@itay-grudev
itay-grudev / rvm.fish
Last active December 12, 2024 16:00
Using RVM with Fish Shell in just 6 lines of code
# ~/.config/fish/functions/rvm.fish
function rvm --description "Ruby Version Manager"
exec bash --login -c "rvm $argv; exec fish" ^&1
end
@marocchino
marocchino / use_whenever_ko.md
Created October 14, 2014 04:13
whenever 사용하기

whenever 사용하기

요즘 이쪽 질문이 많이 올라오길레 정리해 봤습니다.

설치

$ gem install whenever

번들러를 사용한다면, Gemfile에 이렇게 적고