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
<?php | |
class LangUrlRule extends CUrlRule { | |
/** | |
* Регулярное выражение для поддерживаемых языков интерфейса. | |
*/ | |
const LANG_REGEX = '(ru|uk|en)'; | |
/** | |
* Если значение булевой переменно, то правило ведет себя |
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
''' | |
Example of an embeddable module. | |
''' | |
#region get_input | |
def get_input(): | |
''' Scans and returns input until EOF symbol. ''' | |
input_text = '' | |
try: |
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
#!/usr/bin/python | |
''' | |
Template for Rosalind.info problems | |
AFRQ problem (http://rosalind.info/problems/afrq/) is used | |
to illustrate tests and processing input / output. | |
''' | |
import unittest, sys |
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
#!/usr/bin/python | |
''' | |
A little demonstration of decorators in Python. | |
''' | |
import sys | |
def noargs(decorator): | |
''' Decorator enabling use of no-args form for parametric decorators. ''' |
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
#!/usr/bin/python | |
''' | |
Demonstration of functional-style dynamic programming implementation | |
in Python using decorators and generators. | |
Run the script to measure efficiency of decorator-based DP implementations | |
compared to imperative bottom-up implementations (spoiler: decorators are slow). | |
The following recurrent formulas are used: |
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
#!/usr/bin/python | |
''' | |
Implementation of trees with some useful methods: | |
copying, parsing and creating Newick tree representation, getting splits, | |
testing for equality, changing the root node, etc. | |
Most recurrent relationships in trees (e.g., tree splits) are implemented | |
using a custom function decorator. | |
Run as a script to test all methods. |
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
// Not complete, but you get the idea. | |
impl<'a> Transactions<'a> { | |
pub const SERVICE_ID: u16 = 1; | |
fn write_payload(&self, writer: &mut ::exonum::messages::MessageWriter) { | |
match *self { | |
Transactions::CreateWallet { public_key, name } => { | |
let __from = 0 as ::exonum::encoding::Offset; | |
let __size = <&'a PublicKey as ::exonum::encoding::Field>::field_size(); |
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
// Copyright 2018 The Exonum Team | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
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
#[derive(FromAccess)] | |
struct Schema<T: Access> { | |
pub transactions: MapIndex<T::Base, Hash, Transaction>, | |
pub blocks: ListIndex<T::Base, Hash>, | |
pub wallets: ProofMapIndex<T::Base, PublicKey, Wallet>, | |
pub wallet_history: Group<T, PublicKey, ProofListIndex<T::Base, Hash>>, | |
} |
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
/// Cryptocurrency service transactions. | |
#[exonum_interface] | |
pub trait CryptocurrencyInterface<Ctx> { | |
/// Output of the methods in this interface. | |
type Output; | |
/// Creates wallet with the given `name`. | |
#[interface_method(id = 0)] | |
fn create_wallet(&self, ctx: Ctx, arg: CreateWallet) -> Self::Output; | |
/// Transfers `amount` of the currency from one wallet to another. |
OlderNewer