Skip to content

Instantly share code, notes, and snippets.

View mcbarin's full-sized avatar

Mehmet Çağatay Barın mcbarin

  • Crowd Data Systems
  • Colchester
View GitHub Profile
@mcbarin
mcbarin / python.json
Last active November 12, 2021 09:05
my python code snippets in vscode
{
// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "debug",
"body": [
"import ipdb; ipdb.set_trace()"
@mcbarin
mcbarin / test_base.py
Last active September 15, 2021 14:25
My base test codes
from rest_framework.test import APITestCase
from rest_framework import status
class TemporaryAuth:
"""
Use this in tests when you want to authenticate as another user.
args:
- client # (APITestCase().client)
- default_user # The default user used for authentication
@mcbarin
mcbarin / vscode-settings.json
Last active April 21, 2022 09:29
my vscode settings
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--ignore=E226,E266,E501,E502,W605",
"--enable=W0614"
]
}
@mcbarin
mcbarin / gitconfig
Last active April 21, 2022 09:26
git aliases that I use. Add this to .git/config, or to ~/.gitconfig if you want this to be global
[alias]
ci = commit
s = status
f = fetch
st = stash
co = checkout
di = diff --color-words
br = branch
cob = checkout -b
po = "!git push --set-upstream origin \"$(git rev-parse --abbrev-ref HEAD)\""
class KeyboardSensitiveRelativeLayout @kotlin.jvm.JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : RelativeLayout(context, attrs, defStyleAttr) {
var listener: OnKeyboardShowHideListener? = null
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val proposedHeight = MeasureSpec.getSize(heightMeasureSpec)
val actualHeight = height
if (actualHeight != proposedHeight && listener != null) {
if (actualHeight > proposedHeight) {
@mcbarin
mcbarin / dummy_data.py
Created February 12, 2018 14:29
Dummy responses with django using a decorator.
data = {
"TestRequest": {'result': 'Test Response'}
}