This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for dep in $(pip show somepackage | grep Requires | sed 's/Requires: //g; s/,//g') ; do pip uninstall -y $dep ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
sessions: | |
default: | |
database: sribulancer_development | |
hosts: | |
- <%= "#{ENV['SRIBULANCER_DB_1_PORT_27017_TCP_ADDR']}:#{ENV['SRIBULANCER_DB_1_PORT_27017_TCP_PORT']}" %> | |
options: | |
pool_size: 201 | |
options: | |
raise_not_found_error: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: | |
build: . | |
command: bundle exec rails s | |
volumes: | |
- .:/myapp | |
ports: | |
- "3000:3000" | |
links: | |
- db | |
- redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.1.2 | |
RUN apt-get update -qq | |
RUN apt-get install -y debian-keyring debian-archive-keyring | |
RUN apt-key update | |
RUN apt-get install -y build-essential qt5-default libqt5webkit5-dev xvfb | |
RUN mkdir /myapp | |
WORKDIR /tmp | |
COPY Gemfile Gemfile | |
COPY Gemfile.lock Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
grep -v development | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Factory::User | |
def self.make_user(user_type) | |
if user_type == "Knight" | |
@user = Knight.new | |
# Do some Knight specific operation | |
elsif user_type == "Archer" | |
@user = Archer.new | |
# Do some Archer specific operation | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Factory::User | |
def self.make_user(_user_params) | |
if user_params[:type] == "Knight" | |
@user = Knight.new(_user_params) | |
@user.increase_strength(10) | |
@user.decrease_agility(4) | |
# You can add specific logic that come from "unexpected feature" here. | |
# Without editing all logic-contained files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
end | |
class Knight < User | |
end | |
class Archer < User | |
end | |
class UserController < ApplicationController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Order < ActiveRecord::Base | |
after_initialize :change_strategy | |
def set_paid_strategy(paid_strategy) | |
@paid_strategy = paid_strategy | |
end | |
def set_unpaid_strategy(unpaid_strategy) | |
@unpaid_strategy = unpaid_strategy | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Order < ActiveRecord::Base | |
after_initialize :change_state | |
def set_state(order_state) | |
@state = order_state | |
end | |
def change_state | |
# we keep this logic block, to choose what state logic the object use at initialization | |
if self.status == Order::PAID |