Skip to content

Instantly share code, notes, and snippets.

View t4t5's full-sized avatar

Tristan t4t5

View GitHub Profile
@t4t5
t4t5 / art.sh
Created September 3, 2022 13:42
Stable Diffusion script
#!/bin/bash
SD_DIR=~/dev/tools/stable-diffusion
cd $SD_DIR
source venv/bin/activate
echo -n "Enter a prompt: "
read prompt
@t4t5
t4t5 / main.js
Created May 19, 2020 18:44
Electron: Quit macOS app with command + Q
// Quit app on macOS ONLY if using command + Q or some other force quit option:
win = new BrowserWindow({ width: 500, height: 500 })
let forceQuit = false
// Triggered before close event, i.e. when pressing command + Q
app.on('before-quit', () => {
forceQuit = true
})
@t4t5
t4t5 / main.js
Last active May 9, 2022 18:46
Electron: Hide window instead of quitting when closing it
// Hide window instead of quitting when closing it:
win = new BrowserWindow({ width: 500, height: 500 })
win.on('close', e => {
e.preventDefault() // Prevents quit
win.hide()
})
### Keybase proof
I hereby claim:
* I am t4t5 on github.
* I am t4t5 (https://keybase.io/t4t5) on keybase.
* I have a public key ASAPsmlyf5n7MxBYdqXPxnGx8BqDoCAYhOGYtC_7F5z1Ago
To claim this, I am signing this object:
@t4t5
t4t5 / gist:518151ac1d45638e2669a9111c987dc2
Created November 24, 2017 20:25
Blockstack verification
Verifying my Blockstack ID is secured with the address 1P7MsomekKr1U3wuqdjQCZY153YKrr2sgB https://explorer.blockstack.org/address/1P7MsomekKr1U3wuqdjQCZY153YKrr2sgB
@t4t5
t4t5 / sweetalert-with-buttons.js
Created September 6, 2017 14:31
SweetAlert with different number of buttons
// No buttons:
swal({
text: "This modal has no buttons!",
buttons: false,
});
// 1 button:
swal({
text: "Here’s a modal with one button!",
button: "Click me!",
@t4t5
t4t5 / sweetalert-with-async.js
Created September 6, 2017 14:30
Using async with SweetAlert
const deleteFile = async () => {
// Wait for the user to press a button...
const shouldDelete = await swal("Delete file?", "Are you sure that you want to delete this file?", "warning");
if (shouldDelete) {
// Code to actually delete file goes here
swal("Poof!", "Your file has been deleted!", "success");
}
}
@t4t5
t4t5 / sweetalert-with-react.js
Last active September 6, 2017 14:28
SweetAlert content option
// A React component...
const List = () => (
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
)
// Render it as a DOM node...
const wrapper = document.createElement()
@t4t5
t4t5 / index.html
Created April 3, 2017 15:35
todo-app-index
<!-- index.html -->
<html>
<head>
<title>Todo app</title>
<link rel="stylesheet" href="components/todo-list/dist/app.css" />
</head>
<body>
@t4t5
t4t5 / app.scss
Created April 3, 2017 15:24
todo-style
#todo-app {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 60px auto;
max-width: 320px;
padding: 38px;
font-size: 16px;
color: rgba(0, 0, 0, 0.8);
box-shadow:
/* The top layer shadow */
0px 1px 2px rgba(0, 0, 0, 0.18),