Skip to content

Instantly share code, notes, and snippets.

View mnvr's full-sized avatar
🧑‍💻

Manav Rathi mnvr

🧑‍💻
View GitHub Profile
@mnvr
mnvr / index.html
Last active May 2, 2024 15:15
Electron Fiddle to test webUtils.getPathForFile behaviour on Windows
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Paths</title>
</head>
<body>
<input type="file" />
<script>
const input = document.querySelector("input")
@mnvr
mnvr / index.html
Created April 16, 2024 08:19
Electron Fiddle to demonstrate malformed streams with Electron 30.x etc. Send always works (shasum /tmp/myscheme.txt = d269175ac71ed60bb96f08881c39453c8e8d7020). Stream doesn't. Uncommenting the wait makes the stream also work.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"> -->
<title>Stream</title>
</head>
<body>
<button id="send">Send</button><br/>
@mnvr
mnvr / Modify-Xcode-Templates.md
Created January 1, 2024 02:56
Change the template file that Xcode uses when creating a new Swift/SwiftUI file.

Last verified to work with Xcode 15.1.

Ten years later and I still find myself doing this on a new machine. I'd written a script and gist-ed it earlier to save myself time on new machines, but that script and gist got lost to the sands of time, so here's another one.

Open

~/Library/Developer/Xcode
@mnvr
mnvr / cycle.swift
Last active December 22, 2023 15:30
/// All the ways to zip.
///
/// The Swift standard library doesn't seem to have a way to cycle an element so
/// that it can be paired with something else in a zip. These are the ways I've
/// found to achieve the same effect. The last one, `.map({($0, z)})` might be
/// the most idiomatic Swift (and is also the shortest one to express in Swift).
let xs = [1, 2, 3]
let y = 1...10
// Persist the scope window's position across restarts (by default,
// it always starts centered on the screen on each restart).
//
// Usage
// -----
//
// Open the Stethoscope in your startup file, e.g.
//
// s.scope;
//

Building SuperCollider from Source

macOS

SuperCollider's documentation for building on macOS is in the README_MACOS.md file in the SuperCollider. These are additional notes for the way I did it.

Install CMake. This will generate the Xcode project files for building SuperCollider.

@mnvr
mnvr / main.dart
Last active January 2, 2023 02:22
Minimal example demonstrating Flutter InheritedWidgets with mutable state
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyWidget(),
);
@mnvr
mnvr / Finnish.md
Last active June 23, 2019 16:27
Online content I found useful when learning Finnish