This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ConcurrentLinkedQueue | |
interface IQueue { | |
val tasks: ConcurrentLinkedQueue<String> | |
val hasTasks: Boolean | |
var isRunning: Boolean | |
fun addTask(url: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun publicGetUniqueDevSet() : Vector<DevSet?>? { | |
val finder = DeviceFinder() | |
val uniqueDevSet: Vector<DevSet?> = Vector() | |
val devSets = if (Printer.getUserPrinterInfo() == null) { | |
finder.discoverDevice(false) | |
} else { | |
finder.discoverDevice(Printer.getUserPrinterInfo().enabledTethering) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.SharedPreferences | |
import androidx.lifecycle.MutableLiveData | |
import androidx.preference.PreferenceManager | |
import com.orhanobut.hawk.Hawk | |
import com.splashthat.host.extensions.Plank | |
/** | |
* A [LiveData] implementation that reads and persists | |
* it's value using [SharedPreferences] via [Hawk] | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const shell = require('shelljs') | |
const inquirer = require('inquirer') | |
const chalk = require('chalk') | |
/** | |
* Gets a list of Git branches | |
* | |
* @return {Array[String]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Canvas | |
import android.graphics.Color | |
import android.graphics.drawable.ColorDrawable | |
import android.graphics.drawable.Drawable | |
import androidx.recyclerview.widget.ItemTouchHelper | |
import androidx.recyclerview.widget.RecyclerView | |
import com.splashthat.host.R | |
import com.splashthat.host.api.Identifiable | |
import com.splashthat.host.extensions.getColorDrawable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.subjects.PublishSubject | |
/** | |
* Created by adrielcafe on 20/12/17. | |
*/ | |
object KBus { | |
val disposables = mutableMapOf<Any, CompositeDisposable>() | |
val publishSubject = PublishSubject.create<Any>()!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fib = n => (n < 2) ? n : fib(n - 1) + fib(n - 2) | |
const fibSexy = (() => { | |
const cache = {} | |
const f = n => { | |
const value = (n in cache) | |
? cache[n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filters an object returning only properties specified | |
* | |
* @param {Object} obj Source object | |
* @param {Array} keys List of (strings) properties to keep | |
* @return {Object} Object with only props specified in `keys` | |
*/ | |
export const filterKeys = (obj, keepKeys, dropKeys) => { | |
if (typeof obj !== 'object') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a debounced monad to allow a method to be called | |
* many times, but only execute after N seconds has elapsed | |
* | |
* @param {Function} func Method to call | |
* @param {Number} wait Timeout, in milliseconds | |
* @param {Boolean} [immediate] Optionally skip the wait | |
* @return {Function} Debounced monad that can be called multiple times | |
*/ | |
export function debounce(func, wait, immediate) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const throttle = (fn, delay) => { | |
let lastCall = 0 | |
return (...args) => { | |
const now = (new Date).getTime() | |
if (now - lastCall < delay) return | |
lastCall = now | |
return fn(...args) | |
} | |
} |