Skip to content

Instantly share code, notes, and snippets.

View stepancheg's full-sized avatar

Stepan Koltsov stepancheg

View GitHub Profile
@AndrasKovacs
AndrasKovacs / Perm.agda
Last active April 5, 2020 09:56
Permutation relation in Agda. In the indiuctive definition we have insertions on both sides, as opposed to one side. This makes the transitivity proof *horrible* (or at least I couldn't do better).
open import Data.List
open import Data.Nat
open import Relation.Binary.PropositionalEquality
open import Function
open import Data.Product
open import Data.Sum
data _▶_≡_ {A : Set}(x : A) : List A → List A → Set where
here : ∀ {xs} → x ▶ xs ≡ (x ∷ xs)
@cesarfigueroa
cesarfigueroa / paste.js
Created September 25, 2014 23:48
Paste onto a [contenteditable] element as plain text
document.querySelector('[contenteditable]').addEventListener('paste', function (event) {
event.preventDefault();
document.execCommand('inserttext', false, event.clipboardData.getData('text/plain'));
});
@mdwheele
mdwheele / yosemite-sound-issues.md
Created October 22, 2014 00:25
Fix Yosemite Bluetooth Sound Issues
  1. Run the following in your terminal.
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
@Schniz
Schniz / plaintext-contenteditable.css
Last active April 8, 2022 17:46
Plain-Text ContentEditable div for React.js
.comPlainTextContentEditable {
-webkit-user-modify: read-write-plaintext-only;
}
.comPlainTextContentEditable--has-placeholder::before {
content: attr(placeholder);
opacity: 0.5;
color: inherit;
cursor: text;
}
@0XDE57
0XDE57 / config.md
Last active November 18, 2024 12:20
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@Sgeo
Sgeo / gadts.rs
Last active September 10, 2024 19:24 — forked from mstewartgallus/gadts.rs
Gadts in Rust
/// This type is only every inhabited when S is nominally equivalent to T
#[derive(Debug)]
pub struct Is<S, T>(::std::marker::PhantomData<(*const S, *const T)>);
// Construct a proof of the fact that a type is nominally equivalent
// to itself.
pub fn is<T>() -> Is<T, T> { Is(::std::marker::PhantomData) }
// std::mem::transmute does not accept unsubstituted type parameters
// manual transmute as suggested by manual

Proposal to loosen Maximally Minimal Specialization

This is intended to be a possible way of addressing one of the limitations of Maximally minimal specialization: always applicable impls.

I also want to simply mention Sound and ergonomic specialization for Rust as another proposal for solving a different problem with maximally minimal specialization, but my proposal is not related, and should be compatible therewith. I think it is still worth a read.

Please also note that I spent a long time researching and trying to learn as much as I can about the current state of specialization in rust, but there are many years of discussion regarding it, and I probably missed a lot. The above links point to articles that are already almost 4 years old, but they appear to be the most relevant discussions on getting specialization stabili