This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tablet-width: 768px; | |
$desktop-width: 875px; | |
$xl-desktop-width: 1351px; | |
$phone-width: 320px; | |
$iphone6-width: 375px; | |
$iphone6plus-width: 450px; | |
@mixin breakpoint($breakpoint) { | |
@if $breakpoint == "tablet" { | |
@media (min-width: #{$iphone6plus-width}) and (max-width: #{$desktop-width}) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.divider { | |
text-transform: uppercase; | |
color: $dark-grey; | |
font-weight: 600; | |
margin: 20px 0; | |
position: relative; | |
&:before, | |
&:after { | |
content: ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private long mLastClickTime = 0L; | |
findViewById(R.id.button) | |
.setOnClickListener(new OnClickListener() { | |
@Override public void onClick(View v) { | |
// mis-clicking prevention :: 1000 ms | |
if (SystemClock.elapsedRealtime() - mLastClickTime < 1000) return; | |
mLastClickTime = SystemClock.elapsedRealtime(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context context = getContext(); | |
context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()).getComponent().getClassName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.graphics.Bitmap | |
import android.os.Build | |
import android.renderscript.Allocation | |
import android.renderscript.Element | |
import android.renderscript.RenderScript | |
import android.renderscript.ScriptIntrinsicBlur | |
fun blur(context: Context, sourceBitmap: Bitmap, radius: Float): Bitmap { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils import timezone | |
from rest_framework import serializers | |
class DateToTimestampField(serializers.Field): | |
def to_representation(self, value): | |
epoch = timezone.datetime(1970, 1, 1) | |
value = timezone.datetime.fromordinal(value.toordinal()) | |
return int((value - epoch).total_seconds()) * 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Views | |
from rest_framework.generics import CreateAPIView | |
from rest_framework.response import Response | |
class PasswordInitializeAPIView(CreateAPIView): | |
serializer_class = serializers.PasswordInitSerializer | |
def create(self, request, *args, **kwargs): | |
self.check_permissions(request) | |
serializer = self.get_serializer(data=request.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env PYTHONIOENCODING=utf-8 python | |
# encoding: utf-8 | |
"""Git pre-commit hook which lints Python, JavaScript, SASS and CSS""" | |
from __future__ import absolute_import, print_function, unicode_literals | |
import os | |
import subprocess | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
from io import BytesIO | |
from PIL import Image | |
def get_test_image(): | |
file = BytesIO() | |
image = Image.new('RGBA', size=(50, 50), color=(155, 0, 0)) | |
image.save(file, 'png') |