Skip to content

Instantly share code, notes, and snippets.

dfedf
fqe
as
@la10736
la10736 / mr_.gitignore
Last active July 25, 2018 22:18
Milano Rust MeetUp 25/7/2018 MikamaiMars Rover
.idea
/target
**/*.rs.bk
Cargo.lock
mr.iml
@la10736
la10736 / try_minifb_.idea_markdown-navigator.xml
Last active July 29, 2018 20:42
minfb random gray levels
We couldn’t find that file to show.
@la10736
la10736 / rtset_issue2_.gitignore
Created January 14, 2019 11:29
rstest_parametrize in binary
/target
**/*.rs.bk
@la10736
la10736 / lib.rs
Created May 30, 2019 19:53
Rust Meetup Milano 29/5/2019
fn selle(matrix: &impl MatrixTrait) -> Vec<(usize, usize)> {
let mut saddles = vec![];
let (rows, cols) = matrix.size();
let mins: Vec<_> = (0..cols).map(|c| matrix.col_min(c)).collect();
for r in 0..rows {
if let Some(max) = matrix.row_max(r) {
for c in 0..cols {
if let Some(min) = mins[c] {
if matrix.get(r, c) >= max && matrix.get(r, c) <= min {
saddles.push((r, c))
@la10736
la10736 / encoder_.gitignore
Created June 28, 2019 08:49
Rusthero solution
/target
**/*.rs.bk
@la10736
la10736 / test_timeout.rs
Created March 26, 2022 17:06
POC timeout tests async agnostic
use std::time::Duration;
pub async fn delayed_sum(a: u32, b: u32, delay: Duration) -> u32 {
async_std::task::sleep(delay).await;
a + b
}
pub fn delayed_threaded_sum(a: u32, b: u32, delay: Duration) -> u32 {
std::thread::sleep(delay);
a + b
@la10736
la10736 / gist:d96fc4326fcc2c0c3d79d835983bec80
Created June 19, 2022 20:11
Example use fixture from other module
fn main() {
println!("Hello, world!");
}
mod token;
use rstest::rstest;
use token::access_token;
#[rstest]
@la10736
la10736 / .deps...npm...hardhat...console.sol
Created October 4, 2023 16:02
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS =
0x000000000000000000636F6e736F6c652e6c6f67;
function _sendLogPayloadImplementation(bytes memory payload) internal view {
address consoleAddress = CONSOLE_ADDRESS;
/// @solidity memory-safe-assembly