This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait TypeName { | |
fn type_name(&self) -> &str { | |
std::any::type_name::<Self>().trim_start_matches("dyn::") | |
} | |
} | |
impl<T> TypeName for T {} | |
#[cfg(test)] | |
mod tests { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::borrow::Cow; | |
pub trait ReplaceBeginning<'a>: Into<Cow<'a, str>> { | |
fn replace_beginning( | |
self, | |
prefix: impl AsRef<str>, | |
replacement: impl AsRef<str>, | |
) -> Cow<'a, str> { | |
let new_self = self.into(); | |
let prefix = prefix.as_ref(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! make_loop { | |
// do { ... } while cond | |
( | |
do $body:block while $cond:expr | |
) => { | |
loop { | |
$body | |
if !$cond { break; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NodeAT18 < Formula | |
# ... | |
def install | |
# Workaround clang 17+ breaking bug | |
if OS.mac? && DevelopmentTools.clang_build_version >= 1700 | |
ENV.append_to_cflags "-fno-define-target-os-macros" | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Because Shopify sucks at release engineering consistency and insists on imposing overly-complicated, nonstandard build systems | |
# Whoever did this, this is for you: ✨ 🖕 🖕 ✨ | |
set -Eeuo pipefail | |
ver=$(curl -fsSL https://rubygems.org/gems/sorbet-static/versions | sed -E '/darwin/!d;s!</a>!!;s/.*>//' | sort -V | tail -1) | |
gem install sorbet-static-and-runtime -v "$ver" | |
gem install tapioca | |
# Gemfile | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Arduino proper switch debouncing | |
// Based on https://docs.arduino.cc/built-in-examples/digital/Debounce | |
// | |
// Button libraries that do not work properly: | |
// - Button - doesn't debounce | |
// - EZButton - doesn't debounce | |
// - ezButton - laggy | |
// Arduino Nano 5V | |
// 5V pin -> Vcc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ******************************************************************************* | |
// Adapted from https://docs.keyestudio.com/projects/KS0559/en/latest/Arduino/arduino.html | |
/* | |
Keyestudio 4wd BT Car | |
Lesson 17 | |
Bluetooth Multifunctional Car | |
http://www.keyestudio.com | |
*/ | |
#define HAS_LED // Comment out if the LED module is not attached to D9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'cgi' | |
require 'json' | |
require 'open-uri' | |
require 'yaml' | |
UA = 'Ruby script to read the full list of bangs/2.0 ; https://gist.github.com/skull-squadron/f53c38c678045660a36a5fcd1f50196a' | |
module Flow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/aafire.c | |
+++ b/src/aafire.c | |
@@ -2,4 +2,5 @@ | |
#include <stdlib.h> /* exit() */ | |
+#include <time.h> | |
#include "aalib.h" | |
#define XSIZ aa_imgwidth(context) | |
@@ -135,14 +136,29 @@ drawfire (void) | |
aa_scrheight (context)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eEuo pipefail | |
# https://stackoverflow.com/questions/79015158/why-is-gem-clean-reporting-multiple-ambiguous-references-to-the-default-psych | |
# https://stackoverflow.com/q/79015158 | |
targets() { | |
find "$(gem env home)"/specifications/default -name 'rdoc-*.gemspec' | |
} |
NewerOlder