Based on hexlet.io react.js course's final task https://ru.hexlet.io/lessons/one_way_data_flow/theory_unit
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
| xx :: [a] -> [a] -> [[a]] | |
| [] `xx` xs = [] | |
| xs `xx` [] = [] | |
| (a:as) `xx` bs = (a `x` bs) ++ (as `xx` bs) | |
| x :: a -> [a] -> [[a]] | |
| a `x` [] = [] | |
| a `x` (b:bs) = [[a,b]] ++ (a `x` bs) |
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 React from 'react'; | |
| import SchemaBranchMixin from 'baobab-react-schemabranchmixin'; | |
| const Counter = React.createClass({ | |
| displayName: 'Counter', | |
| mixins: [SchemaBranchMixin, ], | |
| schema: { | |
| value: 0, | |
| }, |
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 Focus | |
| import Array | |
| import Maybe | |
| atL Int -> a -> Focus (Array.Array a) a | |
| atL index default = Focus.create ((Maybe.withDefault default) << (Array.get index))\ | |
| (\f r -> (Array.set index | |
| (f (Maybe.withDefault default (Array.get index r))) | |
| r)) |
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
| module Hello where | |
| import Graphics.Element exposing (Element, show) | |
| import Task exposing (Task, andThen) | |
| import Html exposing (..) | |
| import Html.Attributes exposing (style, value) | |
| import Html.Events exposing (onClick, on, targetValue) | |
| import Json.Decode as Json |
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 operator | |
| class Maybe(object): | |
| """ | |
| Basic concept | |
| use https://github.com/Suor/whatever/tree/0d8b2c4fcdcb94f3eb6fa79d2fcdf84c8e39286d | |
| for initial hacking | |
| """ | |
| def __init__(self, val, nothing=None): |
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
| #include <stdio.h> | |
| void add(unsigned long long *dst, unsigned long long *src){ | |
| asm ("movq %0, %%rbx\n" | |
| /*"addq $8, %%rbx\n"*/ | |
| "movq (%%rbx), %%rax\n" | |
| "addq (%1), %%rax\n" | |
| "mov %%rax, (%%rbx)\n" | |
| /*"adcq $0, %%rax\n"*/ |
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
| (item 10 nil | |
| (item 20 nil | |
| (item 30 (item 25 nil) | |
| (item 35 nil)))) | |
| (+ 1 2) ;; 1 + 2 | |
| (def my-fun | |
| (fn [a b c] | |
| (* (+ a 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
| # Есть структура данных описывающая пользователей | |
| # В socket будет попадать открытый обработчик WebSockerHandler | |
| user_list = [{'socket': tornado.websocket.WebSocketHandler(), | |
| 'groups': ['all', 'some group']}, | |
| {'socket': tornado.websocket.WebSocketHandler(), | |
| 'groups': ['other group']}] | |
| #Функция отправки сообщения пользователям | |
| def send_message(message): |
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
| def index(request): | |
| @cached_as(News.objects.all()) #Что тут написать что бы так же работала инвалидация для Tag ? | |
| def _index(): | |
| c = {'news':News.objects.all(), | |
| 'tags':Tag.objects.all()} | |
| return render("index.html", c) | |
| return _index() |