Skip to content

Instantly share code, notes, and snippets.

View adrientetar's full-sized avatar

Adrien Tétar adrientetar

View GitHub Profile
@AlexKGwyn
AlexKGwyn / PinchToZoom.kt
Created April 23, 2023 14:51
Jetpack Compose MacOS Pinch to Zoom modifier
@file:Suppress("JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE")
package com.lottieworks.app.ui
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.LayoutCoordinates
@AveYo
AveYo / @ batch scripts for power users.md
Last active June 13, 2024 07:24
Windows batch scripts for power users

windows_update_toggle.bat v10.1 final
~ one script to rule them all!
~ block build upgrades and/or automatic updates without breawking Store downloads and Defender protection updates
~ there is a lot of focus on Defender updates working independently, unlike any other updates "management" solution
~ ifeo safe blocking with no destructive changes of ownership, deleting files, removing tasks, or over-blocking
~ toggle everything from the Desktop right-click context menu!
but wait, there is more:
~ hide/unhide/install update lists with counter at the Desktop right-click context menu!

Previous update toggle batch suite scripts have been overwritten on pastebin, but will still be available here:

namespace System.Collections.ObjectModel
{
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
@simoncozens
simoncozens / harmonization.md
Last active October 23, 2023 06:42
Harmonizing two Bezier curves

To harmonize (with G2 curvature) two cubic Bézier curves a0,a1,a2,a3 and b0,b1,b2,b3 where a2, a3 = b0, and b1 are colinear:

  • First find d = intersection point of line a1--a2 and line b1--b2.
  • Now find ratios p0 = |a1, a2| / |a2, d| and p1 = |d1, b1| / |b1, b2|.
  • Determine ratio p = sqrt(p0 * p1)
  • Now set position of a3 = b0 such that |a2, a3| / |a3, b1| == p.
  • To do this, set t = p / (p+1).
  • Adjust the position of a3=b0 so that it sits t of the way between a2 and b1.

Of course, you may prefer to keep the position of a3 because it's the on-curve point. Fine. Instead, compute where a3 should go according to this algorithm, work out the delta between the new position and the current position, and apply that delta to the handles a2 and b1 instead.

@be5invis
be5invis / autohint.js
Last active June 28, 2020 16:58
Automatic gridfit generator for Han characters.
var upm = 1000;
function Point(x, y, on, interpolated){
this.xori = x;
this.yori = y;
this.xtouch = x;
this.ytouch = y;
this.touched = false;
this.donttouch = false;
this.on = on;
@staltz
staltz / introrx.md
Last active June 17, 2024 20:46
The introduction to Reactive Programming you've been missing
@Skrylar
Skrylar / result.adoc
Last active March 29, 2021 12:54
Tips for Rust

Tips for Rust: Result Types

Expecting certain outcomes from a Result

Why is it that there is an Option.expect(M), but no Result.expect(M)?

I opened a pull request [pr] which put this in, and it turns out the reason there is no expect function is because you are intended to use composition:

@jvns
jvns / executing-file.md
Last active August 5, 2023 22:24
What happens when I run ./hello
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@perusio
perusio / gist:1154002
Created August 18, 2011 12:54
My ~/.config/lxterminal/lxterminal.conf with solarized colors
[general]
fontname=Terminus 9
selchars=-A-Za-z0-9,./?%&#:_
scrollback=0
bgcolor=#00002b2b3636
bgalpha=65535
fgcolor=#65657b7b8383
disallowbold=false
cursorblinks=false
cursorunderline=false