Skip to content

Instantly share code, notes, and snippets.

View Swisyn's full-sized avatar

Dzhunet Hasan Swisyn

  • kleinanzeigen GmbH
  • Berlin, Germany
  • 01:32 (UTC +02:00)
View GitHub Profile
@DaleLaw
DaleLaw / EventBus.kt
Last active November 2, 2023 15:25
Implement EventBus with Kotlin coroutine
object EventBus {
val bus: BroadcastChannel<Any> = BroadcastChannel()
fun send(o: Any) {
launch {
bus.send(o)
}
}
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active March 19, 2023 08:14
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@buddax2
buddax2 / GoogleTranslate.workflow
Created March 25, 2018 22:37
Google Translate Automator Service
on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=uk&text=" & urldecode(input as string)
return output
end run
on urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode
import numpy as np
import multiprocessing as multi
def chunks(n, page_list):
"""Splits the list into n chunks"""
return np.array_split(page_list,n)
cpus = multi.cpu_count()
workers = []
page_list = ['www.website.com/page1.html', 'www.website.com/page2.html'
@miguelmota
miguelmota / remove_tuxera.sh
Last active April 3, 2024 08:41
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs
@dptsolutions
dptsolutions / Glide4OkHttp3Dagger2Module.java
Created July 2, 2017 22:11
Example AppGlideModule Injecting OkHttpClient using Dagger 2
/**
* {@link AppGlideModule} for the app
*/
@Excludes(OkHttpLibraryGlideModule.class)
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
//Below override should only be used if not using legacy modules registered via manifest
@Override
public boolean isManifestParsingEnabled() {
@mefarazath
mefarazath / GagSsl.java
Last active June 1, 2022 16:07 — forked from chalup/GagSsl.java
Get OkHttpClient which ignores all SSL errors.
private static OkHttpClient getUnsafeOkHttpClient() {
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
String authType) throws CertificateException {
}
@passsy
passsy / KIntent.kt
Last active March 28, 2023 06:51
Kotlin extension functions to start a generic Activity
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@Gurdeep0602
Gurdeep0602 / AppStoryboard.swift
Last active April 2, 2024 09:54
AppStoryboard enumeration
//
// AppStoryboards.swift
// AppStoryboards
//
// Created by Gurdeep on 15/12/16.
// Copyright © 2016 Gurdeep. All rights reserved.
//
import Foundation
import UIKit
@IshankGulati
IshankGulati / RVObserver.java
Last active December 2, 2020 07:54
Base Adapter and RecyclerView.ViewHolder implementation for delegating clicks to Fragment to which adapter is attached. This gist is inspired from https://gist.github.com/aurae/ebf8ec212e4296aebb24 .
/**
* Created by Ishank Gulati on 14/10/16.
* Observer as per Observer design pattern.
*/
public interface RVObserver {
void update(RecyclerViewItemClickListener listener);
}