Sign in

There comes a time when you just need to display an SVG file.

In your gradle add the following. The version may be different as of writing this.

//Coil
implementation "com.google.accompanist:accompanist-coil:0.11.1"
implementation "io.coil-kt:coil-svg:1.1.1"

With this we now have the ability to use an SVGDecoder, that we can use in our composables.

Let say we have a link to an SVG.

val weatherIcon = "https://vreme.arso.gov.si/app/common/images/svg/weather/clear_day.svg"

Now we need to define an image loader

val imageLoader = ImageLoader.Builder(LocalContext.current)
.componentRegistry {
add(SvgDecoder(LocalContext.current))
}
.build()

Then whenever we want to use it we have to pass it to the CompositionLocalProvider. Inside it you define a painter, the rest is classic compose with Image.

CompositionLocalProvider(LocalImageLoader provides imageLoader) {
val painter = rememberCoilPainter(weatherIcon)
Image(
painter = painter,
contentDescription = null,
modifier = Modifier.size(200.dp)
)
...
...other composables
}

This is just one of many in the series of a “Random design and its implementation in jetpack compose beta 08”.

The code and its design might come in handy sometime in the future, might as well share it with others.

Speaking of code, its not pretty, its just to…


Using Jetpack Compose alpha08 build. This post will cover how to draw shapes in Jetpack Compose.

Before starting, it’s good to have a grid notebook, something you can just use pen and paper and draw what you want to draw there first. The 0,0 is always in the top left…


Learn Hiragana and Katakana charaters with some help from plain old JavaScript.

We are making a single html page that will display a random Kana — a random Hiragana and its Katakana equivalent.

Data structure

Lets create app.js, it will contain our JavaScrip, data structure and the function to fetch a random…


Comparing 3 web frameworks, how fast can they render the message “hello” via a templating engine back to the user. There is no optimisation going on. The premise is:

  • pull the framework
  • create the route controller handler
  • assign a variable with a string message
  • create the view for the template…


Sometimes you just need to secure your localhost in order to test some stuff, like OAuth for example.

Create certificate

Creating a certificate for localhost is easy with openssl . Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt

openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Click on the crt file, on macOS the keychain app will open, add the key to it.

Now double click on it and under the trust section you will see “When using this certificate” select “Always Trust”.

Next.js

Now in Next.js we have to create our own server.js file if not already.

Run the server, you now have a secure connection to localhost.


Setting up React with Babel is already available with create-react-app. If you need something configured and just start writing stuff, use that. In this article, we will create our own configuration boilerplate. In doing this we will better understand how these things actually work together.

Init

Setting up working directory. In…


Let’s build a simple Rails API and use Netflixes FastJSON library to serialize our JSON responses.

Project setup

First create a new rails project in api mode.

rails new fjsonrail --api --skip-tests -d mysql

Then in the gem file add the gems:

gem 'faker', '~> 1.9', '>= 1.9.3' …


A simple painter, where you pick a color from a set of preselected ones. And then paint a grid cell with that color. We will be using React Hooks, more specifically useContext and useState. Context will give our components a context of color, which can be set via useState hook.

Init


Usually when somebody thinks chat, they think WebSockets. Normally there are tutorials how you make a server in NodeJs for example and a client in HTML. But in this case the client will also be a NodeJs app. …

Prima

developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store