Skip to content

Instantly share code, notes, and snippets.

View reloni's full-sized avatar
🐡

Anton Efimenko reloni

🐡
  • Moscow
View GitHub Profile
@reloni
reloni / setup carthage
Last active February 18, 2016 13:48
Setup carthage on travis ci
curl -OlL "https://github.com/Carthage/Carthage/releases/download/0.9.4/Carthage.pkg"
sudo installer -pkg "Carthage.pkg" -target /
rm "Carthage.pkg"
@reloni
reloni / gist:62a09f0e67631f62e38b5a3566e0f6bf
Last active April 17, 2018 03:55
Add blur to UITableView (Swift 3)
tableView.backgroundColor = UIColor.clear()
let blurEffect = UIBlurEffect(style: .light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
tableView.backgroundView = blurEffectView
@reloni
reloni / timeZoneAbbreviations
Last active October 28, 2016 06:04
iOS timeZoneAbbreviations
"CEST": "Europe/Paris",
"WEST": "Europe/Lisbon",
"CDT": "America/Chicago",
"EET": "Europe/Istanbul",
"BRST": "America/Sao_Paulo",
"EEST": "Europe/Istanbul",
"CET": "Europe/Paris",
"MSD": "Europe/Moscow",
"MST": "America/Denver",
"KST": "Asia/Seoul",
@reloni
reloni / ioslocaleidentifiers.csv
Created November 10, 2016 09:38 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@reloni
reloni / Postgresql commands.txt
Created November 19, 2016 16:42
Postgresql commands
#install
brew install postgres
#Create db
initdb /path/to/db
#creates user with same name as logged OS user without password
#create user
createuser --pwprompt username
@reloni
reloni / gist:3dec6fb7b9862bd0107eddfbd25e3ba6
Created January 15, 2017 20:28
Observable with interval
extension ObservableType {
func polling(interval: RxTimeInterval, scheduler: SchedulerType = MainScheduler.instance) -> Observable<E> {
return Observable<Int>.interval(interval, scheduler: scheduler)
.flatMapFirst { _ in
return self.asObservable()
}
}
}
@reloni
reloni / gist:b04b0a859f9b6bba81dd3f4de6a18ee8
Created January 15, 2017 20:29
Deferred observable for Notification center
Observable.deferred {
return NotificationCenter.default
.rx
.notification(notifName)
.map { _ ... }
.startWith(IdentityProviderManager.hasFacebookIdentity)
}.distinctUntilChanged()```
@reloni
reloni / Docker with postgresql
Last active May 25, 2017 17:45
Docker with postgresql
Run container with specified pgdata path:
docker run --name pgs-test -p 5432:5432 -v /Users/{user}/pgdata:/var/lib/postgresql/data -e POSTGRES_USER=usr -e POSTGRES_PASSWORD=pass1 -e POSTGRES_DB=db -d pgs-test
Backup:
docker exec pgs-test bash -c 'pg_dump -U usr --format=t --file=/pgback/back1.tar todo'
Restore:
docker exec pgs-test bash -c 'pg_restore -Uusr --create --clean --dbname=todo /pgback/back1.tar'
#dump db
@reloni
reloni / Linux useful
Last active February 26, 2017 08:04
Linux useful
Archive and zip: tar -zcvf test.tar.gz test.txt
Unzip: tar -zxvf test.tar.gz
List ordered by size: ls -lS
Return first field from text file (space delimeted): cut -d" " -f1 somefile.txt (-d delimeter, -f field number)
SSH not send locale:
Remove SendEnv LANG LC_* line in /etc/ssh/ssh_config
SSH not accept locale:
@reloni
reloni / Docker useful
Last active May 30, 2017 04:53
Docker useful
#Delete docker container by name example
#!/bin/bash
CONTAINERID="$(docker ps | grep $1 | cut -d" " -f1)"
docker rm -f $CONTAINERID 1> /dev/null 2> /dev/null
if [ $? -eq 0 ]
then
echo "Successfully delete container $CONTAINERID"
exit 0
else
echo "Container not found" >&2