Skip to content

Instantly share code, notes, and snippets.

@smmoosavi
smmoosavi / .gitconfig
Last active June 25, 2018 07:13
my git alias
[alias]
lg = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr %an)%Creset' --abbrev-commit --date=relative
glg = !git lg --graph
tree = log --graph --decorate --pretty=oneline --abbrev-commit
tr = !LESS="-RFX" git tree
unstage = reset HEAD
last = log -1 HEAD
visual = !gitk
st = status
uncommit = reset --soft HEAD^
@smmoosavi
smmoosavi / fields.py
Created March 30, 2017 17:41
Array Form Field
from django.contrib.postgres.forms import SimpleArrayField, ValidationError, prefix_validation_error
class ArrayField(SimpleArrayField):
def prepare_value(self, value):
return [self.base_field.prepare_value(v) for v in value]
def to_python(self, value):
# see django/contrib/postgres/forms/array.py:37
if value:
items = value
@smmoosavi
smmoosavi / README.md
Last active June 15, 2018 02:33
Proxy example
yarn add http-proxy-middleware express
node proxy.js
@smmoosavi
smmoosavi / mailcatcher.md
Last active February 7, 2017 11:14
how to install mailcatcher

Install mailcatcher

install rvm

src

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby

and close and reopen your terminal.

install mailcatcher

npm run build

commented webpack.optimize.UglifyJsPlugin

build/static/app/css/styles.css

._1gwPWr77dmf4i5iRBt9FXY {
  border-color: #1abc9c !important; }

Some tips for git

Rename branch

git branch -m <oldname> <newname>

source

@smmoosavi
smmoosavi / readme.md
Created September 13, 2015 18:42
Docker commands

Remove all exsited dockers

$ docker rm $(docker ps -q -f status=exited)

source

@smmoosavi
smmoosavi / install-google-chrome.md
Last active March 14, 2018 03:42
Ubuntu 14.04 installing google chrome

When you got this error

$ sudo dpkg -i google-chrome-stable_current_amd64.deb 
sudo: unable to resolve host bayanca05
[sudo] password for bayan-ca-05: 
Selecting previously unselected package google-chrome-stable.
(Reading database ... 174654 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (43.0.2357.81-1) ...
@smmoosavi
smmoosavi / utf8.py
Created May 24, 2015 12:50
UTF8 Python
# -*- coding: utf-8 -*-
@smmoosavi
smmoosavi / README.md
Last active June 22, 2021 06:42
Python terminal colors