Skip to content

Instantly share code, notes, and snippets.

NetOperatorWibby / access.svelte
Last active Mar 5, 2020
Sapper session handling (creation and updating). Idk if this is the best way of doing things but at least it *works*. Feel free to scrutinize this code and let me know all the ways it sucks.
View access.svelte
// import
import { onMount } from "svelte";
// util
import { metadata } from "~util";
// redirect
onMount(() => {
// `location.replace` forces a hard refresh in the browser,
evdama / ThemeToggle.svelte
Created Aug 4, 2019
switch theme between light and dark
View ThemeToggle.svelte
import { onMount } from 'svelte';
let html, currentColorScheme = 'light';
() => {
html = document.getElementsByTagName('html')[0]
window.matchMedia('(prefers-color-scheme: dark)').addListener(({ matches }) => {
if (matches) {
View Quasar v1.0 Upgrade

Quasar 1.0 Upgrade Notes

The Quasar team now have their own upgrade notes as well.

Some simple notes of changes I found during migration from v0.17 to v1.0-beta. I used a fresh app directory created using quasar create <folder> -b dev and copied my components/routes/etc to the new folder.

Renamed Folders

For the most part all folders are the same except for src/plugins. This folder has been renamed to src/boot. They currently function in the same way as before however boot plugins can now by asyncronous.

Router Changes

eirikb / load-vue-components-from-folder.js
Created May 24, 2017
Load all Vue components from a given folder, no need for an "index.js"-file
View load-vue-components-from-folder.js
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))
View Gemfile
source ""
gem "minitest"
gem "rspec"
View gist:09509566cee1f5bb4115
module CallbackPureRuby
def self.included(klass)
klass.extend ClassMethods
module ClassMethods
def initialize_included_features
@callbacks = Hash[:before, {}, :after, {}]
rikukissa / .gitignore
Last active Dec 17, 2015
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
nitschmann / easter_day.rb
Last active Mar 15, 2016
Ruby implementation to find out the easter day date for a specific year (based on Anonymous Gregorian algorithm)
View easter_day.rb
require "date"
# anonymous gregorian algorithm (
def easter_day(year)
if year.is_a?(Integer)
y = year
# calculation
a = y % 19
b = y / 100
c = y % 100
mattiaslundberg / arch-linux-install
Last active Aug 7, 2020
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide ( contains a more verbose description.
# Download the archiso image from
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
XVilka /
Last active Aug 13, 2020
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
You can’t perform that action at this time.