Skip to content

Instantly share code, notes, and snippets.

View snowtema's full-sized avatar

Tema Snow snowtema

  • Russia, St. Petersburg
View GitHub Profile
@snowtema
snowtema / Moon.swift
Created October 12, 2021 18:30
Moon shadow
import UIKit
import Foundation
import PlaygroundSupport
import QuartzCore
import CoreGraphics
import Darwin
let view = UIView(frame: .init(x: 0, y: 0, width: 600, height: 600))
view.backgroundColor = .black
@snowtema
snowtema / Animation.md
Created April 6, 2020 16:48 — forked from JeOam/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

  • view hierarchy
  • layer tree
@snowtema
snowtema / UIProgressView+.swift
Last active October 13, 2018 18:46
UIProgressView animation with RxAnimated
import UIKit
import RxAnimated
import RxSwift
import RxCocoa
extension AnimatedSink where Base: UIProgressView {
public var progress: Binder<Float> {
let animation = self.type!
return Binder(self.base) { (progressView: UIProgressView, progress: Float) in
@snowtema
snowtema / urldecode.sql
Created September 3, 2018 11:29 — forked from paulochf/urldecode.sql
URL decode for MySQL
-- Found at http://stackoverflow.com/a/17922821/597349
DROP TABLE IF EXISTS urlcodemap;
CREATE TABLE `urlcodemap` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`encoded` VARCHAR(128) NOT NULL,
`decoded` VARCHAR(128) NOT NULL,
UNIQUE KEY urlcodemapUIdx1(encoded),
PRIMARY KEY (`id`)
@snowtema
snowtema / Gemfile
Last active February 5, 2018 22:28
Continuous Integration for iOS development with Bitrise CI + Fastlane + Slack
source "https://rubygems.org"
gem "cocoapods"
gem "fastlane"
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
@snowtema
snowtema / install_mongodb.sh
Last active June 26, 2017 10:42
Bash script to install MongoDB extension for LEMP (PHP7.x)
sudo apt-get install php-dev pkg-config libssl-dev libsslcommon2-dev php-pear -y
sudo pecl install mongodb
echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
# Replace 'x' with actual PHP version
service php7.x-fpm restart
service nginx restart