Skip to content

Instantly share code, notes, and snippets.

@teodorpatras
teodorpatras / .bashrc
Last active October 23, 2019 13:55
My .bashrc
alias dstop='docker kill $(docker ps -q)'
alias rmdc='docker rm $(docker ps -a -q)'
alias rmdi='docker rmi $(docker images --filter "dangling=true" -q --no-trunc)'
alias df='df -h '
alias cp='cp -rv'
function Timer(onTick) {
var self = this,
interval,
startTime,
count
self.start = function() {
count = 0
startTime = (new Date()).toISOString()
interval = window.setInterval(function() {
@teodorpatras
teodorpatras / scala.sh
Last active March 17, 2017 12:59
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
## updated for Ubuntu 16.04
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.11.8.deb
sudo dpkg -i scala-2.11.8.deb
sudo apt-get update
sudo apt-get install scala
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
@teodorpatras
teodorpatras / EasyTipViewDismissable.swift
Created June 22, 2016 08:39
EasyTypView + AutoDismissal
extension EasyTipView{
func show(animated animated: Bool = true, forView view: UIView, withinSuperview superview: UIView? = nil, autoDismissAfter: Double) {
self.show(animated: animated, forView: view, withinSuperview: superview)
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(autoDismissAfter * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) { [weak self] in
self?.dismiss()
}
}
}
- (void) performSelectorAsync:(SEL) selector completion:(void(^)(id result))completion {
if ([self respondsToSelector:selector]) {
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
//Background Thread
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:self];