Skip to content

Instantly share code, notes, and snippets.

// 1. Sign into portal.abim.org
// 2. Open dev tools
// 3. Run this in the bar at the bottom
(async function() {
console.log("Fetching results (this could take a minute)...");
let result = (await (await fetch("https://registration.abim.org/api/v1.0/myCombinedRegistrations?pageDefinition.pageIndex=1&pageDefinition.pageSize=500", {
headers: {
Authorization: `Bearer ${access_token}`,
@trezm
trezm / main.dart
Created August 17, 2022 17:15
reverberating-neutron-9682
void main() {
final first = A();
final second = A(b: B(c: C(d: 42)));
print("test1: ${first.b?.c?.d}");
print("test2: ${second.b?.c?.d}");
print("test3: ${first.b?.c?.d ?? "it was null!"}");
}
class A {
#![deny(warnings)]
use std::convert::Infallible;
use futures::stream::StreamExt;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response};
use hyper::server::conn::Http;
use hyper::server::Builder;
use tokio::net::TcpListener;
@trezm
trezm / launch.json
Created August 10, 2018 19:11
Rust VSCode Debugging
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
@trezm
trezm / freezeBenches.js
Created April 25, 2018 20:50
Javascript Freeze Benches
/**
* Freeze access benches
*/
function freezeAccessBench(o) {
return o.val
}
function runFreezeAccessBench(iterations) {
let initial = 0;
#[proc_macro_derive(Render, attributes(TemplateName))]
pub fn render(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
let mut template_location = None;
for attr in &ast.attrs {
match attr.interpret_meta().unwrap() {
syn::Meta::NameValue(val) => {
if val.ident.to_string() == "TemplateName" {
if let syn::Lit::Str(lit) = &val.lit {
template_location = Some(lit.value());
@trezm
trezm / procedural-macro-1.rs
Last active April 10, 2018 13:13
procedural-macro-1
#[proc_macro_derive(Render)]
pub fn render(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
let structName = &ast.ident;
let gen = quote! {
impl Render for #name {
fn render(&self) -> String {
"I'm rendering!".to_owned()
}
@trezm
trezm / handlebars.rs
Created November 21, 2017 03:19
Loading a file for handlebars in rust
extern crate handlebars;
extern crate serde;
extern crate serde_json;
use self::handlebars::Handlebars;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
pub fn index() {
@trezm
trezm / build.rs
Created July 18, 2017 22:13
Neopixel build.rs
extern crate gcc;
extern crate bindgen;
use std::path::PathBuf;
fn main() {
// let bindings = bindgen::Builder::default()
// .no_unstable_rust()
// .header("src-cpp/pinset.hpp")
// .layout_tests(false)
@trezm
trezm / docker-compose.yml
Created May 15, 2017 20:07 — forked from puppybits/docker-compose.yml
sentry docker-compose
redis:
image: redis
postgres:
image: postgres
environment:
- POSTGRES_PASSWORD=sentry
- POSTGRES_USER=sentry
volumes:
- /var/lib/postgresql/data