Skip to content

Instantly share code, notes, and snippets.

@aPinix
aPinix / svg-rounded-rectangle-path.js
Last active April 16, 2024 21:22
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
import de.leonhard.storage.Json;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayInputStream;
@SiAust
SiAust / Serialization.java
Created September 5, 2020 09:45
Example of Serializing some classes.
import javax.imageio.IIOException;
import javax.swing.*;
import java.io.*;
public class HyperSkill {
public static void main(String[] args) {
Person simon = new Person("simon", 21, new Address("stillwater", "uk"));
String fileName = "C:\\users\\si_au\\desktop\\simon.data";
try {
@yuriyskulskiy
yuriyskulskiy / ExpandableTextView.java
Last active April 30, 2023 11:57
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;
@stilllisisi
stilllisisi / Deserialization.java
Last active July 31, 2022 15:48
【java-序列化】Java序列化技术是将对象转变成一串由二进制字节组成的数组,通过将二进制数据保存到磁盘或者传输网络,磁盘或者网络接收者可以在对象的属类的模板上来反序列化类的对象,达到对象持久化的目的。
//2、序列化/反序列化
//可以借助commons-lang3工具包里面的类实现对象的序列化及反序列化,你没有必要自己写。
import org.apache.commons.lang3.SerializationUtils;
public class Test {
public static void main(String[] args) {
User user = new User();
user.setUsername("Java");
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.
@nickbutcher
nickbutcher / MainActivity.kt
Last active February 22, 2024 21:17
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
@adrielAd
adrielAd / ConnectDotsView.java
Created October 11, 2017 13:37 — forked from lecho/ConnectDotsView.java
Connect dots android view.
public class ConnectDotsView extends View {
private Bitmap mBitmap;
private Canvas mCanvas;
private Path mPath;
private Paint mPaint;
private static final int TOUCH_TOLERANCE_DP = 24;
private static final int BACKGROUND = 0xFFDDDDDD;
private List<Point> mPoints = new ArrayList<Point>();
private int mLastPointIndex = 0;
@AliYusuf95
AliYusuf95 / DeviceUtils.java
Created May 7, 2017 13:40
Android device Utils
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.IntDef;
import android.telephony.TelephonyManager;
@AliYusuf95
AliYusuf95 / OnEventListener.java
Last active March 22, 2024 09:42
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);
}