Skip to content

Instantly share code, notes, and snippets.

View johanneskoch's full-sized avatar

Johannes Deva-Koch johanneskoch

View GitHub Profile
@johanneskoch
johanneskoch / project.sass
Created April 14, 2017 13:27
AWS Lambda & LibSass: Example Sass
$brand-primary: peachpuff !default
a
color: $brand-primary
.navbar
background-color: darken($brand-primary, 10%)
@johanneskoch
johanneskoch / manifest.json
Last active April 14, 2017 13:29
AWS Lambda & LibSass: Manifest
{
"brand-primary": "#663399"
}
@johanneskoch
johanneskoch / gist:9a6c251d20d1d1fb0734d270f33664aa
Created April 14, 2017 13:08
AWS Lambda & LibSass: Directory structure
static/
├── css/
│ ├── variation_1/
│ ├── variation_2/
│ │ ├── manifest.json
│ │ └── project.css
│ └── project.css
└── sass/
├── components/
├── mixins/
@johanneskoch
johanneskoch / gist:ee1288f490f8a7640207
Created November 20, 2014 06:45
Additional patch needed to make https://gist.github.com/teeberg/87463ed0cd4dc4ceba6b work with POST-requests
diff --git a/tastypie/fields.py b/tastypie/fields.py
index ae3f291..568788c 100644
--- a/tastypie/fields.py
+++ b/tastypie/fields.py
@@ -644,7 +644,7 @@ class RelatedField(ApiField):
Accepts either a URI, a data dictionary (or dictionary-like structure)
or an object with a ``pk``.
"""
- self.fk_resource = self.to_class()
+ self.fk_resource = self.to_class(api_name=self.api_name)
@johanneskoch
johanneskoch / nested_resources.py
Created December 2, 2013 12:39
Mixins that can be used to easily create nested Tastypie resources. If you for example have a child resource accessible at /api/child-resources/ related to a parent resource accessible at /api/parent-resources/, these would create a URL structure like /api/parent-resources/{detail_uri_name}/child-resources/ that would allow you to access the chi…
from django.conf.urls.defaults import url
from django.db.models.sql.constants import LOOKUP_SEP
from tastypie.utils import trailing_slash
class ParentResourceMixin(object):
""" NOTE: Needs to be filterable on detail_uri_name if not pk """
def prepend_urls(self):
urls = []
@johanneskoch
johanneskoch / extrem_massiv_dramatisch.py
Last active December 30, 2015 00:19
A quick way to stay up to date on how inflated the reporting on Spiegel Online is at any given moment. Any help in getting it down to a tweetable size is greatly appreciated.
import re,requests as r
s=re.sub(r'<.+?>','',r.get('http://spon.de').text).lower()
for p in ['extrem','massiv','dramatisch']:print s.count(p),p