Skip to content

Instantly share code, notes, and snippets.

Electron is tricky to get set up on Windows Subsystem for Linux, but it can work!

Four things needed overall:

  1. you need WSL2, not WSL1
  2. you need node, of course, and that part isn't so bad
  3. you need to apt install several dependencies
  4. you need an X Server so it can display the electron GUI over in Windows-land

Setup instructions, in order:

@caseywatts
caseywatts / 0-self-publishing.md
Last active May 2, 2024 06:04
Self-Publishing via Markdown
@caseywatts
caseywatts / gist:653c762abe1cada63d56f66924f3c794
Last active May 2, 2024 06:04
Using Faker in the Node.js REPL

I learned how to open a module in a Node REPL thanks to this StackOverflow post

How to use Faker in a Node.js REPL

  1. npm install --save-dev "@faker-js/faker
    • = install Faker to your repository
    • (I made an empty project folder because idk how to find -g global ones in node)
  2. node --experimental-repl-await
    • = open the Node REPL with the experimental await feature
  3. let { faker } = await import('@faker-js/faker')
@caseywatts
caseywatts / Download-Slack-Profile-Pictures.js
Last active May 2, 2024 06:04 — forked from jonkwheeler/Download-Slack-Profile-Pictures.js
Download Slack Profile Pictures / Images
// 1. Navigate to the Members View
// Enter slack in the browser. https://{insert your team name here}.slack.com/messages/
// Click on the channel you want.
// Click the information icon.
// Expand the members dropdown.
// Click "See All Members"
// 2. Run JS Code To Start
// Copy-paste this whole thing
@igrigorik
igrigorik / index.html
Created June 8, 2013 22:36
XHR streaming example
<p>Hello
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', '/stream');
xhr.seenBytes = 0;
xhr.onreadystatechange = function() {
console.log("state change.. state: "+ xhr.readyState);
@rivo
rivo / serve.go
Created November 26, 2017 12:28
Graceful stop and restart for HTTP servers in Go
package main
import (
"context"
"fmt"
"net"
"net/http"
"os"
"os/exec"
"os/signal"
@Jomy10
Jomy10 / rust_in_swift.md
Last active May 2, 2024 05:59
Calling Rust library from Swift code (creating executable)

Calling a Rust library from Swift

This gist shows a quick overview of calling Rust in a Swift project, with Swift Package Manager configured.

Let's go ahead and create a folder containing all our sources:

mkdir swift-rs && cd $_
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
flat = {
'some.nested.keys': 'flat'
};
nested = {
some: {
nested: {
@MichalBryxi
MichalBryxi / controllers.application\.js
Created August 19, 2021 14:03
flat vs nested get
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
flat = {
'some.nested.keys': 'flat'
};
nested = {
some: {
nested: {
@sukima
sukima / simple-dom.js
Last active May 2, 2024 05:56
Very small DOM micro-lib using Proxy
/*******************************************/
/* Version 1.0.0 */
/* License MIT */
/* Copyright (C) 2022 Devin Weaver */
/* https://tritarget.org/cdn/simple-dom.js */
/*******************************************/
/**
* This micro lib is a compact and simple method to interact with the DOM. It
* facilitates the query mechanisms that querySelector and querySelectorAll use