Skip to content

Instantly share code, notes, and snippets.

🗣
Mobius time!

Stepan Goncharov stepango

🗣
Mobius time!
Block or report user

Report or block stepango

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
@stepango
stepango / rmbuild.sh
Created Nov 17, 2018
Remove all build folders
View rmbuild.sh
rm -rf `find . -type d -name build`
@stepango
stepango / ObservableFields.kt
Created Jul 19, 2018
Observable fields mapping
View ObservableFields.kt
val nameText = ObservableBoolean(nameHint) { it.isEmpty() }
fun <T: Any> ObservableBoolean(o: ObservableField<T>, f:(T) -> Boolean): ObservableBoolean {
return ObservableBoolean()
.apply {
o.observe {
this.set(f(it!!))
}
}
}
@stepango
stepango / build.gradle
Last active Jun 23, 2018
Alternative build dir
View build.gradle
// your_project_folder/build.gradle
allprojects {
if (new File("your_ram_disk_path").exists())
buildDir = "your_ram_disk_path/build/${rootProject.name}/${project.name}"
}
@stepango
stepango / hfs.sh
Last active Jun 23, 2018
In-Memory HFS+
View hfs.sh
# OSX 4Gb with `RAMDisk` name
diskutil erasevolume HFS+ 'RAMDisk' `hdiutil attach -nomount ram://8388608`
@stepango
stepango / keyboard.lua
Last active Feb 15, 2019
Hammerspoon change layout from Russian to English
View keyboard.lua
ctrlPressed = false
keyPressed = false
layoutWatcher = hs.eventtap.new({hs.eventtap.event.types.flagsChanged, hs.eventtap.event.types.keyUp}, function(e)
local flags = e:getFlags()
local keyCode = e:getKeyCode()
if flags.cmd and keyCode == 0x36 and not (flags.alt or flags.shift or flags.ctrl or flags.fn) then
ctrlPressed = true
keyPressed = false
elseif ctrlPressed and not (flags.cmd or flags.alt or flags.shift or flags.ctrl or flags.fn) and not keyPressed then
View FragmentBindingModule.java
package com.ninetyseconds.auckland.di;
@kotlin.Metadata(mv = {1, 1, 6}, bv = {1, 0, 1}, k = 1, d1 = {"\u0000\u00ea\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u000
@stepango
stepango / ShareAudio.kt
Created May 6, 2017
Share audio file using Android Intent
View ShareAudio.kt
fun shareItem(item: RecordingItem) {
val requestFile = File(item.filePath)
// Use the FileProvider to get a content URI
val fileUri: Uri = FileProvider.getUriForFile(
context,
"${BuildConfig.APPLICATION_ID}.fileprovider",
requestFile
)
View gist:e1785579ab0b5a4389a8c726e453080f
val curried: (Int) -> (Int) -> (Int) -> Int = { i1 -> { i2 -> { i3 -> i1 + i2 + i3 } } }
val partial: (Int) -> (Int) -> Int = curried(2)
@stepango
stepango / NewFeature.kts
Created Apr 10, 2017
new feature branch kotlin script
View NewFeature.kts
fun exec(str: String) = ProcessBuilder(str.split(" "))
.redirectInput(ProcessBuilder.Redirect.PIPE)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
.inputStream
.reader()
.readLines()
.forEach(::println)
View ApiService.java
public final class ApiService implements UserApi, EditsApi, TasksApi, TodosApi, ShootsApi, OthersApi, BrandsApi, BriefsApi, CreatorApi, IdeatesApi, ProjectsApi, PromotesApi, LocationApi, FeedbackApi, ActivityApi, ResourcesApi, WorkflowsApi, ContractsApi, CategoriesApi, AttachmentsApi, RegistrationApi, OpportunitiesApi {
// $FF: synthetic field
private final UserApi $$delegate_0;
// $FF: synthetic field
private final EditsApi $$delegate_1;
// $FF: synthetic field
private final TasksApi $$delegate_2;
// $FF: synthetic field
private final TodosApi $$delegate_3;
// $FF: synthetic field
You can’t perform that action at this time.