Skip to content

Instantly share code, notes, and snippets.

Tomas Harkema tomasharkema

View GitHub Profile
mzaks / debounce.swift
Last active Mar 4, 2019
Swift debounce function based GCD
View debounce.swift
import Foundation
Creates and returns a new debounced version of the passed block which will postpone its execution until after wait seconds have elapsed since the last time it was invoked.
It is like a bouncer at a discotheque. He will act only after you shut up for some time.
This technique is important if you have action wich should fire on update, however the updates are to frequent.
Inspired by debounce function from underscore.js ( )
public func dispatch_debounce_block(wait : NSTimeInterval, queue : dispatch_queue_t = dispatch_get_main_queue(), block : dispatch_block_t) -> dispatch_block_t {
mac-cain13 /
Last active Aug 29, 2015
Automatically copy all PNG assets to the correct Android drawable folder when exporting from for example Sketch.

Android assets folder action

Automatically copy all PNG assets to the correct Android drawable folder. Very helpful when exporting assets with @?x-suffix from, for example, Sketch and putting them into the correct folder without human interaction.


  1. Copy the AppleScript file to ~/Library/Workflows/Applications/Folder Actions
  2. Create a export folder where you'll put all exported PNGs
  3. Right click the folder, choose configure folder actions, check the "Enable folder actions" checkbox and attach the android_assets.scpt to your folder
  4. Open the terminal and create a symbolic link by typing ln -s /path/to/android-project/app/src/main/res /path/to/export-folder-you-just-created
You can’t perform that action at this time.