Skip to content

Instantly share code, notes, and snippets.

View widyakumara's full-sized avatar
:octocat:
๐Ÿ†–๐Ÿ†— ๐Ÿ†–๐Ÿ†— ๐Ÿ†–๐Ÿ†—

Dewa Widyakumara widyakumara

:octocat:
๐Ÿ†–๐Ÿ†— ๐Ÿ†–๐Ÿ†— ๐Ÿ†–๐Ÿ†—
View GitHub Profile
@JHethDev
JHethDev / Btn.svelte
Created April 16, 2020 21:32
Sapper localStorage Example
<script>
import { country } from '../stores/local-store.js;
export let location;
function setCountry(value) {
// We can use this here because _layout calls useLocalStorage for country.
// If you have multiple variables to store each will need to be called
// in the same way in the _layout file.
country.set(value);
}
@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)
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 18, 2025 19:09
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 30, 2025 06:59
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active June 20, 2025 07:25
Hyperlinks in Terminal Emulators
@jamesmartin
jamesmartin / bt.swift
Created March 31, 2017 01:53
Swift example of iterating over all known Bluetooth devices on macOS
import IOBluetooth
// See https://developer.apple.com/reference/iobluetooth/iobluetoothdevice
// for API details.
class BluetoothDevices {
func pairedDevices() {
print("Bluetooth devices:")
guard let devices = IOBluetoothDevice.pairedDevices() else {
print("No devices")
return
@abiosoft
abiosoft / Caddyfile
Created September 18, 2016 16:16
Caddy wordpress docker-compose
:80
root /usr/src/wordpress
gzip
fastcgi / wordpress:9000 php
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?_url={uri}
}
log stdout
errors stderr
@eip
eip / JSON To CLR.applescript.js
Created July 27, 2016 20:08
Convert JSON to Apple Color List (.CLR)
var app;
var clrFilePath;
var colorCnt = 0;
var colorList;
var jsonFilePath;
var nsColorList;
var paletteName;
function hex2rgba(color) {
function ch(pos) {
@rveitch
rveitch / sass-7-1-pattern.scss
Last active June 1, 2025 07:25
Sass 7-1 Pattern
sass/
|
|โ€“ base/
| |โ€“ _reset.scss # Reset/normalize
| |โ€“ _typography.scss # Typography rules
| ... # Etcโ€ฆ
|
|โ€“ components/
| |โ€“ _buttons.scss # Buttons
| |โ€“ _carousel.scss # Carousel