Skip to content

Instantly share code, notes, and snippets.

@IRMobydick
IRMobydick / svg-rounded-rectangle-path.js
Created April 16, 2024 21:22 — forked from aPinix/svg-rounded-rectangle-path.js
Create a rounded rectangle (different radius for each corner)
createSvgRectWithBorderRadius('.wrapper', '#09f', 0, 0, 400, 300, 40, 70, 20, 110);
/**
* Create a rounded rectangle (different radius for each corner)
* @author aPinix <https://twitter.com/aPinix>
* @version 1.0
* @see {@link https://codepen.io/aPinix/pen/dyRvjQq}
* @link https://codepen.io/aPinix/pen/dyRvjQq
* @param {string} elemSelector The selector for the element to append the svg
* @param {string} color The color of the rectangle
@IRMobydick
IRMobydick / OnEventListener.java
Created January 20, 2024 13:49 — forked from AliYusuf95/OnEventListener.java
Websocket implementation using OkHttp3 with {event->data} message format to make your life easier.
public interface OnEventListener {
/**
* Invoked when new message received from websocket with {event, data} structure
*
* @param data Data string received
*/
void onMessage(String data);
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@IRMobydick
IRMobydick / ExpandableTextView.java
Created April 30, 2023 11:57 — forked from yuriyskulskiy/ExpandableTextView.java
ExpandableTV with static layout, solution code
public class ExpandableTextView extends AppCompatTextView
implements View.OnClickListener {
private final int COLLAPSED_MAX_LINES = 3;
private final static String POSTFIX = "...see more ";
private ValueAnimator mAnimator;
private boolean isCollapsing;
private CharSequence mOriginalText;
@IRMobydick
IRMobydick / MainActivity.kt
Created April 4, 2020 11:29 — forked from nickbutcher/MainActivity.kt
Demonstrating how to tile a (Vector) Drawable
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@IRMobydick
IRMobydick / MainActivity.java
Created April 3, 2020 11:45
Custom Android AppBarLayout$ScrollingViewBehavior: Prevent Toolbar from scrolling when RecyclerView doesn't have enough items to scroll.
/*
* Copyright 2016 Alireza Eskandarpour Shoferi
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@IRMobydick
IRMobydick / AppHelper.java
Created July 10, 2017 14:19 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@IRMobydick
IRMobydick / GlideGravatarImageLoader.java
Created November 1, 2016 18:40 — forked from psh/GlideGravatarImageLoader.java
Glide + Gravatar integration to display a user's Gravatar image in an Android ImageView.
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.Transformation;
@IRMobydick
IRMobydick / TopCropImageView.java
Created September 18, 2016 11:19 — forked from arriolac/TopCropImageView.java
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.