Skip to content

Instantly share code, notes, and snippets.

View Saik0s's full-sized avatar

Igor Tarasenko Saik0s

View GitHub Profile
import UIKit
extension UIImage {
func tinted(withLinearGradient gradient: CGGradient, fromTop: Bool = true, blendMode: CGBlendMode = CGBlendMode.normal) -> UIImage {
UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale);
let context = UIGraphicsGetCurrentContext()!
context.translateBy(x: 0, y: self.size.height)
context.scaleBy(x: 1.0, y: -1.0)
context.setBlendMode(blendMode)
@Saik0s
Saik0s / UIColor+Hex.swift
Created April 23, 2017 16:14
UIColor+Hex
//
// UIColor+Hex.swift
//
//
import UIKit
extension UIColor {
convenience init(colorWithHexValue value: Int, alpha:CGFloat = 1.0){
self.init(
let rx_request = Observable<Value>.create { (observer) -> Disposable in
let requestReference = Alamofire.request(.POST, url, parameters: payload)
.responseJSON(completionHandler: { (response) in
if let value = response.result.value {
observer.onNext(value)
observer.onCompleted()
}else if let error = response.result.error {
observer.onError(error)
}
})

Videos

@Saik0s
Saik0s / SomePlayground.swift
Created July 18, 2017 16:30 — forked from juliengdt/SomePlayground.swift
Strongly Type Identifiers For Class Or Struct By Using Protocol and associated types
/*
In response of Tom Lokhort's article.
A third alternative: alternative 2 under steroïds
---
Source: http://tom.lokhorst.eu/2017/07/strongly-typed-identifiers-in-swift
*/
struct GenericIdentifier<T>: RawRepresentable, Hashable, Equatable {
let rawValue: String
@Saik0s
Saik0s / gen.swift
Created August 4, 2017 04:45 — forked from blainerothrock/gen.swift
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
@Saik0s
Saik0s / hide-dock.sh
Created September 16, 2017 04:04
hide dock
set -e
defaults write com.apple.Dock autohide-delay -float 5
defaults write com.apple.dock tilesize -int 1
killall Dock
# restore defaults
# defaults delete com.apple.Dock autohide-delay
@Saik0s
Saik0s / Fresh-Install.markdown
Last active October 11, 2017 13:31 — forked from ericboehs/Fresh-Install.markdown
What I do after a fresh install of Mac OS X
@Saik0s
Saik0s / _Setup_new_laptop.md
Created October 13, 2017 13:04 — forked from elipapa/_Setup_new_laptop.md
Steps to set up a new osx laptop for data science and computational biology work

Set up a new os x laptop

Steps to setup a new OS X laptop with a data science & computational biology development environment.

Last updated: 7 Jan 2017 macOS: Yosemite => Sierra

Sure you could try to do this from dotfiles, but historically something has broken and required manual input anyway. So, inspired by the pragmatism of paul irish bash setup script and a few other gists written in markdown like this, I rolled my own.

Some design considerations:

@Saik0s
Saik0s / sVimrc
Last active October 23, 2017 04:37
" sVimrc
let lastactivetablimit = 50
let lastclosedtablimit = 50
let scrollduration = 20
let scrollstep = 160
let homeurl = "http://google.com"
let newtaburl = "http://google.com"
" Shortcuts
map "?" help