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
""" Inspired by http://flask.pocoo.org/snippets/40/ """ | |
app = Flask(__name__) | |
@app.url_defaults | |
def hashed_url_for_static_file(endpoint, values): | |
if 'static' == endpoint or endpoint.endswith('.static'): | |
filename = values.get('filename') | |
if filename: | |
if '.' in endpoint: # has higher priority |
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
; pen test on functional programming | |
(define (min-2 a b) (if (> a b) b a)) | |
(define (min-3 a b c) (min-2 (min-2 a b) (min-2 b c))) | |
(define (sq x) (* x x)) | |
(define (foo a b c) (cond ((= a (min-3 a b c)) (+ (sq b) (sq c))) | |
((= b (min-3 a b c)) (+ (sq a) (sq c))) | |
(else (+ (sq a) (sq b))))) |
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
'use strict'; | |
/** | |
* Пример использования socket.io namespaces в сервисе AngularJS. | |
* | |
* Цель: получить несколько отдельных каналов связи в рамках одного соединения. | |
* | |
* Проблема: так как сервисы в AngularJS являются синглтонами, не возможно | |
* получить несколько экземпляров сервиса Socket с разными значениями | |
* namespace. При этом хочется иметь отдельные сервисы, представляющие |
NewerOlder