Skip to content

Instantly share code, notes, and snippets.

View winnietong's full-sized avatar

Winnie Tong winnietong

  • marqeta.com
  • San Francisco, CA
View GitHub Profile
@winnietong
winnietong / gist:ac5cf6f4632e10ea8abf0d7dfa81c4ff
Created December 8, 2016 01:36 — forked from geuis/gist:1489bbd1a8e47e86db38
Force jshint validation with pre-commit hook (bash)
#!/bin/sh
# Run changed javascript files through jshint before commiting and prevent bad
# code from being committed.
# If you need to prevent newly added js from being checked because its in a
# library like bower_components, add a .jshintignore file and list the directory
# INSTALL: Add as a file in your repo as .git/hooks/pre-commit
FILES=$(git diff --cached --name-only --diff-filter=ACM| grep ".js$")
if [ "$FILES" = "" ]; then
exit 0
@winnietong
winnietong / Add new local env to PyCharm
Last active August 29, 2015 14:26
How to start a Django Project
- Click on PyCharm -> Preferences
- Click on Project Interpreter -> Python Interpreter
- Click on the "+" -> Local
- Go to your home directory -> .virtualenvs -> writers -> bin
- Choose the file that's just called python
@winnietong
winnietong / Python examples
Last active August 29, 2015 14:14
Examples
# https://www.dropbox.com/s/xpfbcnnnkmjvwdv/Screenshot%202015-02-02%2022.02.06.png?dl=0
# Equilibrium problem
array = [-1, 3, -4, 5, 1, -6, 2, 1]
def solution(array):
right = sum(array)
left = 0
before = 0
for index, val in enumerate(array):
### Installer logs ###
pip-log.txt
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
*.pyc