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
struct MagnificationGestureExample: View { | |
@State var rectangleScaleEffect: CGFloat = CGFloat(1) | |
var body: some View { | |
// Создаем MagnificationGesture | |
let magnificationGesture = MagnificationGesture() | |
// Изменяем scale effect для прямоугольника | |
.onChanged { value in | |
self.rectangleScaleEffect = value | |
} |
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
struct DragGestureExample: View { | |
@State var rectangleOffset: CGSize = .zero | |
var body: some View { | |
// Создаем DragGesture | |
let dragGesture = DragGesture() | |
// При изменение локации мы пересчитываем значения отступа для прямоугольника | |
.onChanged { value in | |
self.rectangleOffset = value.translation | |
} |
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
struct LongPressGestureExample: View { | |
@State var rectangleColor = Color(.green) | |
var body: some View { | |
// Создаем LongPressGesture | |
// Жест будет срабатывать только если нажатие длилось как минимум 2 секунды | |
let longPressGesture = LongPressGesture(minimumDuration: 2, maximumDistance: 10) | |
.onEnded { _ in | |
if self.rectangleColor == .red { | |
self.rectangleColor = .green |
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
struct TapGestureExample: View { | |
@State var rectangleColor = Color(.green) | |
var body: some View { | |
// Создаем TapGesture | |
// Для обработки используем метод onEnded, который выполняется после завершения тапа | |
let tapGesture = TapGesture().onEnded { _ in | |
if self.rectangleColor == .red { | |
self.rectangleColor = .green | |
} else { |
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
from datetime import datetime | |
from collections import OrderedDict | |
def generate_sid(): | |
current_sid = 1 | |
while True: | |
yield str(current_sid) | |
current_sid += 1 |
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
from datetime import datetime | |
from queue import PriorityQueue | |
def generate_sid(): | |
current_sid = 1 | |
while True: | |
yield str(current_sid) | |
current_sid += 1 | |
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
from datetime import datetime | |
def generate_sid(): | |
current_sid = 1 | |
while True: | |
yield str(current_sid) | |
current_sid += 1 | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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<iostream> | |
#include<immintrin.h> | |
#include<time.h> | |
#define XOR(a, b) _mm256_xor_si256(a, b) | |
#define AND(a, b) _mm256_and_si256(a, b) | |
#define OR(a, b) _mm256_or_si256(a, b) | |
#define AND_NOT(a, b) _mm256_andnot_si256(a, b) | |
#define ADD(a, b) _mm256_add_epi32(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
#include<iostream> | |
#include<immintrin.h> | |
__m256i const PRIMES[] = { | |
32416182577, | |
32416183169, | |
32416183781, | |
32416184263, | |
32416182583, |
NewerOlder