How to rebase local branch with remote branch
git fetch; and git rebase origin/branch-name-goes-here
Unstage files
git reset
Find out when a file was removed from GitHub repo
class DataFetch < SimpleDelegator | |
include Enumerable | |
delegate :each, :grep, to: :@collection | |
NOTHING = proc {} | |
def initialize(collection, otherwise = NOTHING) | |
super(@collection = collection) | |
@otherwise = otherwise | |
end |
class Method | |
def by(*head) | |
to_proc.by(*head) | |
end | |
def with(*head, &blk) | |
to_proc.with(*head, &blk) | |
end | |
def as(such) |
class DelegateToCurrent | |
delegate :current, to: :@context | |
delegate_missing_to :current | |
def initialize(context) | |
@context = context | |
end | |
define_singleton_method(:[], &method(:new)) | |
end |
How to rebase local branch with remote branch
git fetch; and git rebase origin/branch-name-goes-here
Unstage files
git reset
Find out when a file was removed from GitHub repo
module ApplicationRecord::Exceptions | |
Failure = ActiveRecord::ActiveRecordError | |
UpdateFailure = ActiveRecord::RecordInvalid | |
UndoTransaction = ActiveRecord::Rollback | |
end |
class RefinementsOf < Module | |
def initialize(*types, with: nil, &block) | |
super(&block) | |
types.each_with_object(include(*with)) do |type, m| | |
refine(type) do prepend m | |
module_exec(m, &block) if block_given? | |
end | |
end |
class CloudStoring < SimpleDelegator | |
def new(params) | |
super with_dropbox_key(params) | |
end | |
def reset_dropbox_key(id, storing: find(id)) | |
storing.update! with_dropbox_key | |
end | |
private |
# app/controllers/feature_photo_controller.rb | |
class FeaturePhotoController < ApplicationController | |
include DCI::Roles(user_photos: Featuring) | |
before_action :authenticate_user! | |
before_action -> { with! user_photos: current_user.photos } | |
def create | |
if user_photos.feature params[:photo_id] | |
redirect_to photos_path |
class Alive < Set; include Cartesian | |
def next | |
Alive.new merge(&NEIGHBORS).select { |cell| thriving? cell } | |
end | |
def thriving?(cell) | |
live_neighbors = neighboring(cell).size | |
3 == live_neighbors or (2 == live_neighbors and include?(cell)) | |
end | |
end |
module Nothingness | |
using Module.new { | |
refine NilClass do | |
def *(number) | |
end | |
end | |
} | |
refine Numeric do | |
alias_method :nothing?, :zero? |