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
// Paste into <https://turf-sandbox.netlify.app/> | |
function sampleLine(inputLine, distanceMeters) { | |
let inputLength = turf.length(inputLine, "m") | |
let samples = [] | |
for (let i = 0; i < Math.floor(inputLength); i+=distanceMeters) { | |
let point = turf.along(inputLine, i, 'm') | |
samples.push(point["geometry"]["coordinates"]) | |
} | |
samples.push(inputLine["geometry"]["coordinates"].at(-1)) |
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
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:46:40 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:46:41 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:46:41 geder gnome-shell[6176]: Removing a network device that was not added | |
Jun 05 01:47:41 geder gnome-shell[6176]: Removing a network device that was not added |
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
0 tests, 0 benchmarks | |
encoding_any_prop: test | |
encoding_prop: test | |
2 tests, 0 benchmarks | |
test::json_any_array: test | |
test::json_any_bool: test | |
test::json_any_map: test | |
test::json_any_null: test | |
test::json_any_number: test |
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
defp clear_record_id_error(changeset) do | |
errors = | |
changeset.errors | |
|> Enum.filter(fn | |
{:record_id, _} -> false | |
_ -> true | |
end) | |
if Enum.empty?(errors) do | |
%{changeset | errors: [], valid?: true} |
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
defmodule Wrench.Hex.Api.Requester do | |
use GenServer | |
require Logger | |
@config Application.get_env(:wrench, __MODULE__) | |
@api_key @config[:api_key] | |
@ua "Wrench/#{Application.spec(:wrench, :vsn)} (contact #{Application.get_env(:wrench, :operator_contact)})" | |
@endpoint "https://hex.pm/api" | |
def start_link(opts) do |
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
private class SectionsAnimationState constructor( | |
initialPosition: PagePosition, | |
private val renderer: Renderer, | |
private val onPosition: (PaginatedTextPosition) -> Unit, | |
) { | |
private val _positionBacking = mutableStateOf(initialPosition) | |
private var lastPageReportedToOnPosition = initialPosition.page.roundToInt() | |
private var _position | |
get() = _positionBacking.value | |
set(value) { |
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
Compiling lldb-sys v0.0.20 (/home/daniel/lldb-sys.rs) | |
The following warnings were emitted during compilation: | |
warning: src/lldb/Bindings/SBCommandInterpreterBinding.cpp: In function ‘SBCommandInterpreterRunOptionsOpaque* CreateSBCommandInterpreterRunOptions()’: | |
warning: src/lldb/Bindings/SBCommandInterpreterBinding.cpp:22:99: error: invalid use of incomplete type ‘class lldb::SBCommandInterpreterRunOptions’ | |
warning: 22 | return reinterpret_cast<SBCommandInterpreterRunOptionsRef>(new SBCommandInterpreterRunOptions()); | |
warning: | ^ | |
warning: In file included from /usr/lib/llvm-11/include/lldb/API/SBBreakpoint.h:12, | |
warning: from src/lldb/Bindings/SBBreakpointBinding.h:15, | |
warning: from src/lldb/Bindings/LLDBBinding.h:21, |
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
Edit: TLDR: If you need to talk to a library that's very hard to write a completely sound abstraction for, consider writing a mostly sound one (with a clear disclaimer) instead of switching to a different language. Obviously this would be stupid if your code operates on untrusted inputs, but plenty of stuff doesn't. I'm writing code that takes input from your kernel. | |
I've been thinking recently about various articles by people who have given up on Rust projects, such as [the Way Cooler post mortem](http://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html). I think one of the problems is that people sometimes feel it's "wrong" to write unsound code in Rust, so they give up or switch to another language, write unsound code in that language, and feel better about it. By unsound I mean unsafe code that is undefined behavior, i.e. violates the memory safety model of rust. | |
I find it interesting that I'm my experience people newer to writing unsafe Rust tend to see soundness in binary terms, whereas at l |
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 ring::digest::{Algorithm, Context, Digest}; | |
use std::{fmt, io}; | |
pub struct WithDigest<W> { | |
inner: W, | |
ctx: Context, | |
} | |
impl<W> WithDigest<W> { | |
pub fn new(algorithm: &'static Algorithm, inner: W) -> Self { |
NewerOlder