This file contains hidden or 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
const data = { | |
version: 2, | |
}; | |
jQuery(document).trigger('updateSidebarData', [data]); |
This file contains hidden or 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
<script src="https://unpkg.com/vue"></script> |
This file contains hidden or 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 re | |
from flask import Flask | |
from flask.helpers import send_from_directory | |
# Subclass Flask and override send_static_file method | |
class CustomStaticFlask(Flask): | |
def send_static_file(self, filename): | |
"""Overrides to filter out cache buster from file path | |
Input images/file.{hash}.css |
This file contains hidden or 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
# In manage.py add | |
# Make sure you import: from flask import url_for | |
@app.context_processor | |
def override_url_for(): | |
return dict(url_for=external_url_for) | |
def external_url_for(endpoint, **values): | |
# Force absolute url in assets | |
if app.config.get('FORCE_EXTERNAL_URL'): |
This file contains hidden or 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
class TastypieApiKeyUserMiddleware(object): | |
""" | |
Middleware for per-request authentication with tastypie | |
""" | |
# Name of request header to grab username from. This will be the key as | |
# used in the request.META dictionary, i.e. the normalization of headers to | |
# all uppercase and the addition of "HTTP_" prefix apply. | |
header = 'HTTP_AUTHORIZATION' | |
method = 'apikey' | |
apikey_auth = ApiKeyAuthentication() |
This file contains hidden or 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
# EditorConfig is awesome: http://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
trim_trailing_whitespace = true |
This file contains hidden or 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 requests, re | |
problem_name = 'even-or-odd' | |
problem_url = 'https://www.codewars.com/kata/' + problem_name | |
users = [ 'fabiopedrosa', 'johnsardine', 'disbeat', 'pgcmarques', 'nnunobm', 'alexp100' ] | |
problem_id = re.findall('<div class="info-row code-challenge" data-id="(.+?)"', requests.get(problem_url).text)[0] | |
users = dict( [ (u, []) for u in users ] ) | |
for user in users: |
This file contains hidden or 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
// In RegExr http://regexr.com/3dqqv | |
/([@][A-z]+)|([#][A-z]+)|((?:(?:https?|ftp):\/\/|www\.)[^\s/$.?#].[^\s]*)/g |