Skip to content

Instantly share code, notes, and snippets.

View bopbi's full-sized avatar
💭
🕺 🕺

Bobby Prabowo bopbi

💭
🕺 🕺
View GitHub Profile
@RBusarow
RBusarow / TestCoroutineExtension.kt
Last active November 20, 2023 19:03
A JUnit 4 Rule and JUnit 5 Extension for utilizing TestCoroutineDispatcher and TestCoroutineScope from kotlinx.coroutines-test
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.jupiter.api.extension.AfterAllCallback
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.BeforeAllCallback
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.extension.ExtensionContext
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 4, 2024 04:45
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@nvkiet
nvkiet / [Swift] Hide-show keyboard
Created August 20, 2014 14:16
Hide/Show keyboard with Swift language
func handleKeyboardWillShowNotification(notification: NSNotification) {
if self.inputContainerViewBottomLayoutGuideConstraint.constant == 0 {
keyboardWillChangeFrameWithNotification(notification, showKeyboard: true)
scrollBubbleTableViewToBottomAnimated(true)
}
}
func handleKeyboardWillHideNotification(notification: NSNotification) {
if self.inputContainerViewBottomLayoutGuideConstraint.constant > 0 {
keyboardWillChangeFrameWithNotification(notification, showKeyboard: false)
@ryanbateman
ryanbateman / gist:6667995
Last active September 6, 2017 21:03
Basic BlurTransformer for Square's Picasso
import android.content.Context;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class BlurTransform implements Transformation {
@JakeWharton
JakeWharton / BindingAdapter.java
Last active July 25, 2023 05:49
An adapter base class that uses a new/bind pattern for its views.
// Apache 2.0 licensed.
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */
public abstract class BindableAdapter<T> extends BaseAdapter {
@j4rs
j4rs / client.js
Created July 9, 2012 22:26
NodeJS GCM Server to send message to android devices...
var GCM = require('./gcm');
var gcm = new GCM(<YOUR GOOGLE API KEY>); // https://code.google.com/apis/console
// create the message
var msg = {
registration_ids: [token], // this is the device token (phone)
collapse_key: "your_collapse_key", // http://developer.android.com/guide/google/gcm/gcm.html#send-msg
time_to_live: 180, // just 30 minutes
data: {
@martinsik
martinsik / chat-frontend.js
Last active December 19, 2023 10:23
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;