Skip to content

Instantly share code, notes, and snippets.

View dpmedeiros's full-sized avatar

Daniel Medeiros dpmedeiros

View GitHub Profile
@hrach
hrach / channel.kt
Last active May 24, 2021 08:52
Kotlin Channels Debounce & Throttle
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlin.coroutines.experimental.CoroutineContext
fun <E> ReceiveChannel<E>.debounce(
wait: Long = 50,
context: CoroutineContext = DefaultDispatcher
): ReceiveChannel<E> = produce(context) {
@Armaxis
Armaxis / emoji_bitbucket.js
Last active March 16, 2017 18:33
Custom JS for Bitbucket that adds few buttons
//This custom JS adds few missing features to Bitbucket's code review tool
//1) emoji buttons to Edit page to easily mark Pull Request
//2) 'No whitespaces' button is added next to 'Commits' and 'Activity' and reloads the page with whitespaces diff turned off.
//I'm not familiar with JS or jQuery, so this code is ugly and could be much better. But it works, so I have that going for me which is nice
//I used Chrome Extension to enable usage of this code: https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija?hl=en
//Reference to last focused text field
var lastFocused;
$("input[type='text']").focus(function() {
lastFocused = document.activeElement;
@ademar111190
ademar111190 / firebase.sh
Created June 22, 2016 17:51
A script to send data notifications
#!/bin/bash
# https://github.com/firebase/firebase-tools
# https://firebase.google.com/docs/cloud-messaging/server
DEVICE="<< DEVICE TOKEN >>"
KEY="<< SERVER KEY>>"
JSON="
{
\"to\": \"$DEVICE\",
@pyricau
pyricau / IMMLeaks.java
Last active June 5, 2022 22:46
"Fix" for InputMethodManager leaking the last focused view: https://code.google.com/p/android/issues/detail?id=171190
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
@soarez
soarez / ca.md
Last active May 3, 2024 00:04
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@foozmeat
foozmeat / openssl-build.sh
Last active December 12, 2023 19:41
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@afair
afair / bash.cheat
Created August 27, 2012 20:23
Bash Scripting Quick Reference
==========================================
BASH SCRIPTING ==========================================
========================================== TEST COMMAND
==========================================
Invoke: bash [options] file
Shebang: #!/usr/bin/env bash Test: test expression
In script: [ expression ]
========================================== Alternate: [[ espression ]]
LOOP Does not split string words
========================================== Does not expand pathglobs*
@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git