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
.text { | |
text-shadow: 2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 1px 1px #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; | |
} | |
/* https://stackoverflow.com/questions/13426875/text-border-using-css-border-around-text */ |
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.http import HttpResponse | |
urlpatterns = patterns('', | |
... | |
(r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", mimetype="text/plain")) | |
) |
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.views.generic import ListView | |
from sampleapp.models import Sample | |
class CustomListView(ListView): | |
def get_queryset(self): | |
query_dict = self.request.GET | |
return Sample.objects.filter(**query_dict.dict()) | |
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 | |
""" | |
Abstraction above configuration data: | |
Used to load any data in dictionary format into object, | |
as class properties. | |
Example: | |
data = {'threads':30, 'name':'Stan', 'something':[1, 'dd', 13]} | |
cfg = config.AbstractConfig(data) | |
print cfg.threads |
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.contrib import admin | |
from .models import Post | |
@admin.register(Post) | |
class PostAdmin(admin.ModelAdmin): | |
pass |
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
app.config(["$locationProvider", function($locationProvider) { | |
$locationProvider.html5Mode(true); | |
}]); |
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.http import HttpResponse | |
urlpatterns += url(r'^robots.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", content_type="text/plain")) |
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
sudo su - postgres | |
psql | |
CREATE DATABASE myproject; | |
CREATE USER myproject WITH PASSWORD 'myproject'; | |
ALTER ROLE myproject SET client_encoding TO 'utf8'; | |
ALTER ROLE myproject SET default_transaction_isolation TO 'read committed'; | |
ALTER ROLE myproject SET timezone TO 'UTC'; | |
ALTER ROLE myproject CREATEDB; | |
GRANT ALL PRIVILEGES ON DATABASE myproject TO myproject; | |
\q |
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 djstripe.models import Customer | |
from djstripe.settings import CANCELLATION_AT_PERIOD_END | |
from tastypie import http | |
def subscription(self, request, **kwargs): | |
self.method_check(request, ['get', 'post', 'delete']) | |
if request.user.is_authenticated(): | |
user = request.user | |
customer = Customer.objects.get(subscriber=user) | |
if request.method == 'GET': |
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/sh | |
fallocate -l 2G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
sysctl vm.swappiness=10 | |
echo "vm.swappiness=10" >> /etc/sysctl.conf | |
sysctl vm.vfs_cache_pressure=50 | |
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf |
OlderNewer