This file contains 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
type ValueType = number | |
const InvalidValue: ValueType = 1 << 0, | |
StringValue: ValueType = 1 << 1, | |
NumberValue: ValueType = 1 << 2, | |
NilValue: ValueType = 1 << 3, | |
BoolValue: ValueType = 1 << 4, | |
ArrayValue: ValueType = 1 << 5, | |
ObjectValue: ValueType = 1 << 6 |
This file contains 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
// | |
// 1. Дано N ячеек с произвольным содержимым (content: number) | |
// | |
// 2. На вход поступает содержимое произвольной длины (number) | |
// | |
// 3. Нужно распределить входящее содержимое по ячейкам так, чтобы сначала заполнить наиболее полные ячейки | |
// | |
// 4. Если места не хватает, надо упасть с ошибкой | |
// | |
// Например: |
This file contains 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
#!/bin/sh | |
PRIVATE_KEY="ECDSA" | |
PUBLIC_KEY="ECDSA.pub" | |
BITCOIN_PRIVATE_KEY="bitcoin" | |
BITCOIN_PUBLIC_KEY="bitcoin.pub" | |
echo "Generating private key" | |
openssl ecparam -genkey -name secp256k1 -rand /dev/random -out $PRIVATE_KEY |
This file contains 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 Foundation | |
// Export running app as .ipa, then return path to exported file. | |
// Returns String because app crashes when returning URL from async function for some reason... | |
func exportIPA() async throws -> String | |
{ | |
// Path to app bundle | |
let bundleURL = Bundle.main.bundleURL | |
// Create Payload/ directory |
This file contains 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 | |
function declOfNum($num, $titles) { | |
$cases = array(2, 0, 1, 1, 1, 2); | |
return $num . " " . $titles[($num % 100 > 4 && $num % 100 < 20) ? 2 : $cases[min($num % 10, 5)]]; | |
} | |
echo declOfNum(5, array('человек просит', 'человека просят', 'человек просят')); |
This file contains 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 ScrollViewWithHeight extends StatelessWidget { | |
final Widget child; | |
const ScrollViewWithHeight({Key key, this.child}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { | |
return new SingleChildScrollView( | |
child: new ConstrainedBox( |
This file contains 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 | |
namespace src\Integration; | |
use src\Contracts\ApiRequestInterface; | |
use src\Contracts\ApiResponseInterface; | |
use src\Contracts\ApiClientInterface; | |
use Psr\Http\Client\ClientInterface; | |
/** |
This file contains 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
enum HTTPMethod: String { | |
case get = "GET" | |
case put = "PUT" | |
case post = "POST" | |
case delete = "DELETE" | |
case head = "HEAD" | |
case options = "OPTIONS" | |
case trace = "TRACE" | |
case connect = "CONNECT" | |
} |
This file contains 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 'dart:async'; | |
import 'dart:collection'; | |
import 'dart:isolate'; | |
/// Easy and convenient to use, thread-pool-like implementation for delegating | |
/// expensive tasks to a pool of isolates | |
/// | |
/// Just pass the function and the desired params to [commission] and let | |
/// the site handle everything for you by returning a really parallel computed [Future] object. | |
/// If the [Site] currently holds a reference to an idle Isolate, then the requested computation |
This file contains 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 Foundation | |
/// A thread-safe array. | |
public class SynchronizedArray<Element> { | |
fileprivate let queue = DispatchQueue(label: "io.data.SynchronizedArray", attributes: .concurrent) | |
fileprivate var array = [Element]() | |
} | |
// MARK: - Properties | |
public extension SynchronizedArray { |
NewerOlder