Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Toshihiro Suzuki toshi0383

🏠
Working from home
Block or report user

Report or block toshi0383

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View share-and-initial-value.swift
let hotdogProperty = BehaviorSubject<String>(value: "")
Observable<Int>
.interval(1.0, scheduler: ConcurrentMainScheduler.instance)
.map { "Nice \($0)" }
.startWith("bonapetit!")
.debug("[source]")
.subscribe(onNext: { hotdogProperty.onNext($0) })
func hotdogObservable() -> Observable<String> {
return hotdogProperty.asObservable()
View combine-latest.go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
View combine-latest.go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
View cat.go
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
View RxSmartThrottleTests.swift
import XCTest
@testable import RxSmartThrottle
final class RxSmartThrottleTests: XCTestCase {
static var allTests = [
("test_Throttle__customInterval__ExponentialBackoff", test_Throttle__customInterval__ExponentialBackoff),
("test_Throttle__customInterval__latest__false", test_Throttle__customInterval__latest__false),
("test_Throttle__customInterval__throttleUntil", test_Throttle__customInterval__throttleUntil),
]
}
View RxSmartThrottle.swift
import Foundation
import RxSwift
extension ObservableType {
/**
Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.
This operator makes sure that no two elements are emitted in less then each consulted dueTime.
View mac-file-extensions.swift
import Foundation
// script to retrieve these file extensions.
//
// (for i in $(/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep ' \.[a-zA-Z][a-zA-Z]*' | sed -n 's/.*: *\(.*\)/\1/p' | sort | uniq | sed "s,[ '],,g" | sed 's/,/ /g'); do echo $i; done) | grep '^\.' | grep -v '^\.\.*$' | sort | uniq | sed 's/\(.*\)/"\1",/'
//
let allFileExtensions = [
"3gp",
"3gpp",
"Mac",
View command-u.scpt
tell application "Xcode" to activate
tell application "System Events"
keystroke "u" using command down
end tell
@toshi0383
toshi0383 / chrome_tabs.osa
Created Jul 6, 2018 — forked from samyk/chrome_tabs.osa
applescript to show all url+titles of Chrome tabs along with front window+tab url+title
View chrome_tabs.osa
# shows all url+titles of Chrome along with front window+tab url+title
set titleString to ""
tell application "Google Chrome"
set window_list to every window # get the windows
repeat with the_window in window_list # for every window
set tab_list to every tab in the_window # get the tabs
repeat with the_tab in tab_list # for every tab
@toshi0383
toshi0383 / main.swift
Last active Jun 26, 2018
find file sizes in given directory
View main.swift
import Foundation
var fm: FileManager {
return .default
}
/// 指定されたディレクトリ以下のファイルサイズ合計を求める.
/// サブディレクトリ以下も再帰的に調べる.
/// 加算するメタデータ値はtotalFileAllocatedSize.
func findSize(at directoryPath: String) -> Int64? {
You can’t perform that action at this time.