Skip to content

Instantly share code, notes, and snippets.

@CryogenicPlanet
CryogenicPlanet / .eslintrc
Created June 6, 2021 12:29
Typescript Mono Repo Guide
// .eslintrc
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"react-app",
"plugin:react/recommended",
@max10rogerio
max10rogerio / slugify.ts
Last active May 25, 2024 15:58
Typescript slug function
// MIT License
// Copyright (c) 2023 Max Rogério
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@Merott
Merott / tailwind-colors-as-css-variables.md
Last active June 23, 2024 12:06
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.

@raylee
raylee / icbm.service
Last active March 18, 2021 19:08
Example installation of golang service under Debian systemd
# /etc/systemd/system/icbm.service
[Unit]
Description=Internet Connected Beverage Monitor data server
Documentation=https://lunarville.org
Wants=network.target
After=network.target
[Service]
Type=simple
@sconstantinides
sconstantinides / styles.css
Created April 27, 2018 23:06
PWA media queries
/* Replace "standalone" with "fullscreen" depending on your manifest.json display mode */
@media (display-mode: standalone) {
/* All installed PWAs */
}
@media (max-width: 576px) and (display-mode: standalone) {
/* Installed PWAs on mobile devices */
@supports (-webkit-overflow-scrolling: touch) {
@samthor
samthor / autocert-server.go
Last active April 15, 2024 15:47
Demo autocert server in Go
package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/user"
@chusiang
chusiang / teams-chat-post-for-workflows.sh
Last active July 22, 2024 03:50
Post a message to Microsoft Teams with bash script.
#!/bin/bash
# =============================================================================
# Author: Chu-Siang Lai / chusiang (at) drx.tw
# Filename: teams-chat-post-for-workflows.sh
# Modified: 2024-07-22 11:44 (UTC+08:00)
# Description: Post a message to Microsoft Teams via "Post to a chat when a webhook request is received" workflows.
# Reference:
#
# - https://gist.github.com/chusiang/895f6406fbf9285c58ad0a3ace13d025
# - https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/
@aka-mj
aka-mj / unixsock_ex.go
Created February 9, 2017 19:32
Unix Socket Example in Go
package main
import (
"fmt"
"net"
"os"
"time"
)
func listen(end chan<- bool) {
@ipbastola
ipbastola / jq to filter by value.md
Last active June 21, 2024 14:29
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@Paradoxis
Paradoxis / http-to-ws.js
Last active May 13, 2024 16:37
Convert WS/HTTP links with JavaScript
/**
* Converts an HTTP(S) url to a WS(S) URL
* Example:
* httpUrlToWebSockeUrl("http://www.example.com/") -> ws://www.example.com/
* httpUrlToWebSockeUrl("https://www.example.com/") -> wss://www.example.com/
*
* @param {string} url
* @return {string}
*/
function httpUrlToWebSockeUrl(url)