Skip to content

Instantly share code, notes, and snippets.

View JasonLo's full-sized avatar

Jason Lo JasonLo

View GitHub Profile
@JasonLo
JasonLo / alt_no_max.py
Last active January 8, 2022 18:11
Altair disable max row
# Altairs by default will not take dataframe with more than 5000 rows.
# This command will disable this limit.
alt.data_transformers.disable_max_rows()
@JasonLo
JasonLo / git_2_remote.sh
Last active January 6, 2022 22:59
git tracking differnt remote branch
# Assume we already have a remote called origin linked to this repo
# Add a new remote called "upstream"
git remote add upstream https://github.com/owner/repo.git
# Set local master branch to track from upstream master
git branch -u upstream/master master
# Create a new private branch for development
git checkout -b dev
@JasonLo
JasonLo / .pre-commit-config.yaml
Created November 21, 2021 02:44
Formatting and clear output pre-commit hook #pre-commit
repos:
- repo: https://github.com/psf/black
rev: 21.11b1
hooks:
- id: black
language_version: python3.8.10
exclude: references/
- repo: local
hooks:
- id: jupyter-nb-clear-output
@JasonLo
JasonLo / break.py
Last active April 2, 2020 16:05
Flow control snippet for #psychopy
# Add this component code in a break routine
# Select when to break after trial no. x
break_after_trial = [2, 5]
# Terminate this routine if this trial no. is not in break_after_trial
# Note: trials.thisN is the current item no. with zero indexing
# i.e., 1st item a participant see is 0, 2nd item is 1...
if not((trials.thisN + 1) in break_after_trial):
continueRoutine = False