View CsvResponse.php
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
<?php | |
namespace Jb\AdminBundle\Http; | |
use Symfony\Component\HttpFoundation\Response; | |
class CsvResponse extends Response | |
{ | |
protected $data; |
View fabfile.py
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
fabfile for Django | |
------------------ | |
see http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p/ | |
modified for fabric 0.9/1.0 by Hraban (fiëé visuëlle) | |
several additions, corrections and customizations, too |
View routers.py
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 random | |
class MasterSlaveRouter(object): | |
def db_for_read(self, model, **hints): | |
""" | |
Reads go to a randomly-chosen slave. | |
""" | |
return random.choice(['master','slave1', 'slave2']) | |
def db_for_write(self, model, **hints): |
View translate.py
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
# -*- coding: utf-8 -*- | |
""" | |
You need to fill in your API key from google below. Note that querying | |
supported languages is not implemented. | |
Language Code | |
-------- ---- | |
Afrikaans af | |
Albanian sq | |
Arabic ar |
View premailer.py
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
# Put in 'templatetags' folder in your Django app. | |
from __future__ import absolute_import | |
from django import template | |
from django.utils.encoding import smart_text | |
from django.contrib.staticfiles import finders | |
from django.contrib.staticfiles.storage import staticfiles_storage | |
from django.conf import settings | |
from premailer import Premailer |
View Connectivity.java
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
/* | |
* Copyright (c) 2017 Emil Davtyan | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* "Software"), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: |
View Android-Tint-LottieAnimationView.kt
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
/** | |
* Tint LottieAnimationView | |
*/ | |
private fun LottieAnimationView.tintColor(@ColorInt tintColor: Int) { | |
addValueCallback( | |
KeyPath("**"), | |
LottieProperty.COLOR_FILTER, | |
{ PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_ATOP) } | |
) | |
} |
View android-kotlin-custom-view-template
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
/** | |
* VerticalDottedLineView | |
* Add to attrs.xml: | |
* <declare-styleable name="VerticalDottedLineView"> | |
* <attr name="dots_color" format="color" /> | |
* </declare-styleable> | |
*/ | |
class VerticalDottedLineView : View { | |
private var dotColor: Int = 0 |
View Create_docker.sh
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
#!/bin/bash | |
docker build \ | |
--file Dockerfile \ | |
--tag registry.andrej-albrecht.com/sms-api-gateway/sag-web-backend/cloud_test:latest \ | |
--build-arg DJANGO_ENV=cloud_test \ | |
. | |
View Dockerfile
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 python:3.6-stretch | |
ARG DJANGO_ENV=dev | |
ENV PYTHONUNBUFFERED 1 | |
# Requirements have to be pulled and installed here, otherwise caching won't work | |
COPY ./requirements/base.txt /base.txt | |
COPY ./requirements/cloud_production.txt /cloud_production.txt | |
COPY ./requirements/${DJANGO_ENV}.txt /requirements_${DJANGO_ENV}.txt |
OlderNewer