Skip to content

Instantly share code, notes, and snippets.

use std::sync::mpsc::{self, Sender};
use tokio::sync::oneshot;
use futures::Future;
// We erase the job signature to: "no arguments, no return value"
// Because the job itself is responsible for sending its typed result
type ErasedJob = Box<dyn FnOnce() + Send + 'static>;
struct JobPool {
tx: Sender<ErasedJob>,
use std::sync::mpsc::{self, Sender};
use tokio::sync::oneshot;
use futures::Future;
// A trivial job type
type Job = Box<dyn FnOnce() -> String + Send>;
// A “synchronous” pool that receives jobs
struct JobPool {
tx: Sender<(Job, oneshot::Sender<String>)>,
commit 6df138a2c634f5dbdb5a131add00bb1bb5118756
Author: William Casarin <[email protected]>
Date: Mon Dec 9 16:39:37 2024 -0800
async: adding efficient, poll-based stream support
This is a much more efficient, polling-based stream implementation that
doesn't rely on horrible things like spawning threads just to do async.
Changelog-Added: Add async stream support
commit 3552189390f2693fea6ed6acbcb08b1b17db0bd5
Author: Robert Bragg <[email protected]>
Date: Wed May 25 23:57:45 2022 +0100
glue: remove unused variable
diff --git a/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c b/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
index ce6c7efdb8aa..626e7b82c10d 100644
--- a/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
+++ b/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
@jb55
jb55 / focus_state.diff
Created March 8, 2025 00:06
Auto focus on navigate example in notedeck
commit d85c6043b700783d825f6e5971f976e198fde112
Author: William Casarin <[email protected]>
Date: Fri Mar 7 16:01:55 2025 -0800
search: auto-focus search field on navigate
I'm going to add a search changelog on this commit since I forgot
to do so previously.
Fixes: https://linear.app/damus/issue/DECK-538/auto-focus-search-field-on-search-view
@jb55
jb55 / rsa-acc.js
Created June 24, 2019 00:38 — forked from syuhei176/rsa-acc.js
RSA accumulator
const primeNumberList = require('prime-number/list')
const BigNumber = require('bignumber.js');
const utils = require('ethereumjs-util');
// const primeNumberList = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47];
BigNumber.config({
DECIMAL_PLACES: 2,
ROUNDING_MODE: BigNumber.ROUND_FLOOR
})
@jb55
jb55 / keybase.md
Created May 11, 2019 04:02
keybase high security key

Keybase proof

I hereby claim:

  • I am jb55 on github.
  • I am jb55 (https://keybase.io/jb55) on keybase.
  • I have a public key whose fingerprint is 5B2B 1E4F 6221 6BC7 4362 AC61 D4FB A2FC 4535 A2A9

To claim this, I am signing this object:

@jb55
jb55 / main.rs
Created September 1, 2018 18:10
extern crate actix_web;
extern crate serde;
extern crate futures;
#[macro_use]
extern crate serde_derive;
mod activitypub;
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LinkOr<T> {
Link(String),
NotLink(T)
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
@jb55
jb55 / main.rs
Created September 1, 2018 00:36
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
use std::io;
extern crate httparse;
fn main() {
let bind = "127.0.0.1";