Skip to content

Instantly share code, notes, and snippets.

View dhable's full-sized avatar

Dan Hable dhable

View GitHub Profile
struct WeightedValueGen<'a, T, const N: usize> {
values: [&'a T; N],
weights: [f32; N],
}
impl<'a, T, const N: usize> WeightedValueGen<'a, T, N> {
#[allow(dead_code, unused_mut)]
fn new(input: &'a [(T, f32); N]) -> Self {
let mut values = unsafe {
let mut values: [mem::MaybeUninit<&T>; N] = mem::MaybeUninit::uninit().assume_init();
@dhable
dhable / LICENSE
Created October 7, 2021 17:40 — forked from rcook/LICENSE
Bracket pattern in Rust
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
package appito;
import java.util.ArrayList;
import java.util.List;
class Queen
{
private int xPos = 0;
private int yPos = 0;
@dhable
dhable / configuration.nix
Last active February 6, 2017 15:26
I spent some time with NixOS trying to make a development environment similar to my Mac. Not suggested for full time desktop use yet.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
"""
Check out the differences between the select.poll functionality in CPython
and Jython.
"""
import socket
import errno
import threading
import traceback
import logging
import select

Keybase proof

I hereby claim:

  • I am dhable on github.
  • I am dhable (https://keybase.io/dhable) on keybase.
  • I have a public key whose fingerprint is DE59 E486 02AC FF51 6B89 8E0F E5DB 13D5 94B9 DE28

To claim this, I am signing this object:

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@dhable
dhable / promise.js
Last active December 31, 2015 18:38
A quick promise implementation in JS to showcase how simple it is to implement a promise. Don't use in a production app!
function promise() {
var listeners = [],
resolved = false,
data;
return {
isResolved: function() {
return resolved;
},