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 Foundation | |
public struct AppStorageKeys { | |
public var userOnboarding: AppStorageKey<Bool> { .init("user_onboarding", defaultValue: false) } | |
public var updateFrequencyTimeInterval: AppStorageKey<Double> { .init("update_frequency_time_interval", defaultValue: 1.0) } | |
} | |
public struct AppStorageKey<Value> { | |
let name: String | |
let defaultValue: 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
#!/bin/bash | |
# | |
# This script unpair selected device if is paired and vice versa | |
# for example, to quickly switch mouse and keyboard between macs | |
# Install `blueutil` with Brew before use this script! | |
# For get device ID run `blueutil --paired` and get "address" (as is) | |
# P.S. This script will be more convenient with Automator... | |
# for Homebrew on M1 | |
export PATH="$PATH:/opt/homebrew/bin" |
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 ubuntu:16.04 | |
WORKDIR /app | |
RUN apt update | |
RUN apt-get install -y \ | |
build-essential \ | |
pkg-config \ | |
libssl-dev \ | |
curl | |
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | |
ENV PATH="/root/.cargo/bin:${PATH}" |
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
extension Array where Element: Hashable { | |
/// Result entity for `diff(with:)` | |
typealias DiffResult = (old: [Element], changed: [Element], new: [Element]) | |
/** | |
Return difference between two arrays. | |
- Parameter newArray: New array. | |
- Returns: DiffResult entity with: |
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
<div id="tg-post"></div> | |
<script> | |
let GROUP_NAME = "" | |
let MIN_POST_ID = 3 | |
let MAX_POST_ID = 100 | |
function randomIntFromInterval(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min) | |
} | |
let post_id = randomIntFromInterval(MIN_POST_ID, MAX_POST_ID); |
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 Keycode { | |
// Layout-independent Keys | |
// eg.These key codes are always the same key on all layouts. | |
static let returnKey : UInt16 = 0x24 | |
static let enter : UInt16 = 0x4C | |
static let tab : UInt16 = 0x30 | |
static let space : UInt16 = 0x31 | |
static let delete : UInt16 = 0x33 | |
static let escape : UInt16 = 0x35 |
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
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-Universal | |
# Make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
# Copy the framework structure (from iphoneos build) to the universal folder | |
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" | |
# Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory | |
BUILD_PRODUCTS="${SYMROOT}/../../../../Products" |
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
open_in_xcode() { | |
xfile=$1 | |
if [[ -d "$xfile" && ${xfile: -12} == ".xcworkspace" ]]; then | |
open -a Xcode.app "$xfile" | |
elif [[ -d "$xfile" && ${xfile: -12} == ".xcodeproj" ]]; then | |
open -a Xcode.app "$xfile" | |
else | |
echo "Find project file in current dir." | |
project_files=( | |
$(find . -type d -depth 1 -name "*.xcworkspace") |
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
#!/bin/bash | |
# Example: echo "Hello" | tg_alert.sh | |
# For find out the chat ID, use https://api.telegram.org/bot<token>/getUpdates | |
# | |
message=$1 | |
apiToken="<TG_BOT_API_KEY>" | |
chatId="<TG_CHAT_ID>" | |
if [[ ! -z "$message" ]]; then |
NewerOlder