When you want to be specific:
To remove a file
git rm --cached <file>
To remove a directory
git rm -r --cached <folder>
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
failed=0 | |
for file in ${files}; do |
When you want to be specific:
To remove a file
git rm --cached <file>
To remove a directory
git rm -r --cached <folder>
This guide is targetted at intermediate or expert users who want low-level control over their Python environments.
When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda
). See the Using the workflow section to view the end result.
Ref : stackoverflow
The best solution in my opinion is to use the unittest
[command line interface][1] which will add the directory to the sys.path
so you don't have to (done in the TestLoader
class).
For example for a directory structure like this:
new_project
├── antigravity.py
class Api::V1::ProfitAndLossController < ApplicationController | |
def index | |
render json: Sale.get_profit_and_loss, each_serializer: ProfitAndLossSerializer | |
end | |
end |
class Client < ApplicationRecord | |
... | |
def self.get_top_customers | |
month = Sale.get_latest_month | |
Client.find_by_sql [ | |
"WITH top_cust AS ( | |
SELECT SUM(sales.amount) AS sales_17, | |
SUM(discounts.amount) AS discounts_17, | |
SUM(sales.amount) + SUM(discounts.amount) AS net_sales_17, |
class DashboardSerializer < ActiveModel::Serializer | |
attributes :clusters, | |
:products, | |
:categories, | |
:net_sales_curr_year, | |
:segment_contribution, | |
:net_sales_prev_year, | |
:discounts_17 | |
def net_sales_prev_year |
WITH {subquery_name} AS ( | |
{subquery_body} | |
) | |
SELECT ... | |
FROM {subquery_name} | |
WHERE ... |
class Sale < ApplicationRecord | |
... | |
def self.get_latest_month | |
Sale.order(transaction_date: :desc) | |
.limit(1) | |
.pluck(:transaction_date)[0] | |
.month | |
end | |
end |
class Sale < ApplicationRecord | |
... | |
def self.get_dashboard | |
month = get_latest_month | |
Sale.find_by_sql [ | |
"WITH ytd_2017 AS ( | |
SELECT SUM(sales.amount) AS sales_17, | |
SUM(discounts.amount) AS discounts_17, | |
client_clusters.name AS clusters, |