Skip to content

Instantly share code, notes, and snippets.

jan-heise /
Created Apr 22, 2020
Enable Darkmode Variants in TailwindUI depending on OS / Browser Settings

Enable Darkmode Variants in TailwindUI depending on OS / Browser Settings

To enable darkmode variants simply add the following lines to the theme/extend section of your tailwind config

screens: {
    'dark-mode': {'raw': '(prefers-color-scheme: dark)'},

This enables the dark-mode variant for your classes. You are now able to use dark-mode:bg-gray-900 on your site.

tigt / git-branch-to-favicon.js
Created Mar 18, 2020
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
View git-branch-to-favicon.js
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
nicbet / Dockerfile
Created Jun 27, 2019
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
View Dockerfile
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
sergeycherepanov /
Last active Jan 5, 2021
Traefik Systemd Example with letsencrypt
# /etc/traefik/conf.d/
backend = "blog"
passHostHeader = true
entrypoints = ["https", "http"]
priority = 100
extractorfunc = "client.ip"
period = "10s"
josephan /
Last active Dec 16, 2021
Add Tailwind CSS to an Elixir/Phoenix Project with PurgeCSS
LouisCAD / GooglePlayServices.kt
Created Nov 23, 2017
Allows using Google Play Services Task API in Kotlin Coroutines, plus Play Services availability check made easier.
View GooglePlayServices.kt
import splitties.init.appCtx
import kotlin.coroutines.experimental.suspendCoroutine
val googleApiAvailability = GoogleApiAvailability.getInstance()!!
inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx)
suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation ->
View KtorApp.kt
package main
import com.zaxxer.hikari.HikariDataSource
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.mapping.Environment
import org.apache.ibatis.session.Configuration
import org.apache.ibatis.session.SqlSession
import org.apache.ibatis.session.SqlSessionFactory
import org.apache.ibatis.session.SqlSessionFactoryBuilder
yowu / HttpProxy.go
Last active Aug 19, 2022
A simple HTTP proxy by Golang
View HttpProxy.go
package main
import (
artem-zinnatullin / GradleWorkersPleaseStopTakingFocus.gradle
Created Jul 21, 2015
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
View GradleWorkersPleaseStopTakingFocus.gradle
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'