Skip to content

Instantly share code, notes, and snippets.

@maxtortime
maxtortime / prepare-commit-msg
Last active Jul 30, 2020 — forked from qkraudghgh/shell
feature/sample 이름을 가진 브랜치일때 커밋 메시지 앞에 [sample] 을 붙여주는 훅
View prepare-commit-msg
#!/bin/sh
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop release hotfix)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD 2> /dev/null)
if [ $? -eq 0 ]; then
BRANCH_NAME="${BRANCH_NAME##*/}"
@maxtortime
maxtortime / shell
Created Jul 30, 2020 — forked from qkraudghgh/shell
pre commit
View shell
#!/bin/bash
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop release hotfix)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
JIRA_ID=`echo $BRANCH_NAME | grep -oE '[A-Z]+-[0-9]+'`
@maxtortime
maxtortime / test.py
Created Oct 23, 2018
filter by annotated window
View test.py
qs = ConditionOccurrence.objects.filter(
condition_concept_id__in=ConceptSet.objects.get(pk=1198).concepts.values(
'pk')).annotate(ordinal=Window(expression=RowNumber(), order_by=F(
'condition_start_date').asc(), partition_by=[F('person_id')])).filter(ordinal=1)
...
django.db.utils.NotSupportedError: Window is disallowed in the filter clause.
@maxtortime
maxtortime / example.html
Created Aug 13, 2018
django navbar for문
View example.html
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
{% for menu in menus %}
<li class="nav-item {{ menu.active }}">
<a class="nav-link" href="{{ menu.path }}">{{ menu.name }}</a>
</li>
{% endfor %}
</ul>
<a href="{% url 'logout' %}">LOGOUT</a>
</div>
@maxtortime
maxtortime / example.py
Last active Aug 13, 2018
navbar 만들기
View example.py
# context_processors.py
def menus(request):
return {
'menus': [
{'path': reverse(path), 'name': name,
'active': 'active' if request.get_full_path() == reverse(
path) else ''}
for path, name in
(
('drug_sim', 'CONCEPT SETS'), ('biomarker', 'BIOMARKER'),
View test.py
class A:
b = 3
a = A()
print(a.b) # 3
a.c = 4
print(a.c) # 4
View eslintrc.js
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
View eslintrc.js
// http://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
@maxtortime
maxtortime / settings.json
Last active Apr 29, 2018
Adjust eslint-plugin-vue
View settings.json
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"eslint.enable": true,
"files.trimTrailingWhitespace": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.DS_Store": true,
@maxtortime
maxtortime / example.py
Created Apr 17, 2018
python apscheduler example
View example.py
import json
import time
import os
import requests
import collection
import logging
import time
from apscheduler.schedulers.blocking import BlockingScheduler