Skip to content

Instantly share code, notes, and snippets.

View meoyawn's full-sized avatar

Adel Nizamutdinov meoyawn

View GitHub Profile
@meoyawn
meoyawn / xml.kt
Last active February 29, 2024 16:17
fast XML DSL in 70 lines
package lib.xml
import org.apache.commons.text.StringEscapeUtils
fun StringBuilder.put(attrs: Array<out Pair<String, Any?>>) {
for ((k, v) in attrs) {
if (v == null) continue
append(' ')
append(k)
@jan-heise
jan-heise / readme.md
Created April 22, 2020 06:56
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
tigt / git-branch-to-favicon.js
Created March 18, 2020 21:10
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.
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')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)
@nicbet
nicbet / Dockerfile
Created June 27, 2019 03:00
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \
@josephan
josephan / setup_tailwind_in_phoenix.md
Last active August 8, 2023 05:50
Add Tailwind CSS to an Elixir/Phoenix Project with PurgeCSS
@wanjos
wanjos / .block
Last active August 21, 2023 12:51 — forked from ahmohamed/README.md
D3.js v4: Panning with mouse wheel
license: gpl-3.0
@LouisCAD
LouisCAD / GooglePlayServices.kt
Created November 23, 2017 16:19
Allows using Google Play Services Task API in Kotlin Coroutines, plus Play Services availability check made easier.
import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.tasks.Task
import splitties.init.appCtx
import kotlin.coroutines.experimental.suspendCoroutine
val googleApiAvailability = GoogleApiAvailability.getInstance()!!
inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx)
@JvmName("awaitVoid")
suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation ->
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
yowu / HttpProxy.go
Last active March 28, 2024 12:47
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)