Skip to content

Instantly share code, notes, and snippets.

View scooter-dangle's full-sized avatar
🆗
高兴

Scott Steele scooter-dangle

🆗
高兴
View GitHub Profile
@scooter-dangle
scooter-dangle / anchors.md
Last active July 28, 2024 14:34
markdown anchor example

See [anchor-example]

My first section

Lorem ipsum odor amet, consectetuer adipiscing elit. Nibh suscipit curae habitant tincidunt eu cursus donec. Lacus torquent morbi dictumst suscipit quam sem euismod inceptos. Laoreet netus semper pharetra facilisi velit odio luctus. Magnis convallis vel vitae varius lacus quisque eu. Donec elementum curae aliquet adipiscing auctor ac diam tempor. Quisque nullam gravida ligula per ligula non semper penatibus. Dictum enim dis mus rhoncus ridiculus facilisis vulputate cursus.

Euismod scelerisque ornare pharetra commodo consequat lectus. Avel velit mauris commodo sollicitudin felis adipiscing nascetur. Sollicitudin ligula dictumst eros justo nascetur; lobortis varius bibendum sociosqu. Potenti ad quam litora adipiscing commodo suspendisse eros. Leo auctor placerat laoreet magna interdum quis lacinia at. Ornare justo aliquet non nisl orci taciti nunc. Dapibus arcu quis sagittis congue consectetur quam. Sed mollis lacus fusce eros sapien su

@scooter-dangle
scooter-dangle / main.rs
Created July 21, 2021 00:29
Playing around at the July 20 Rust DC meetup
use std::sync::Arc;
// #[derive(Debug)]
// struct Database(Vec<User>);
// #[derive(Debug, Default)]
// struct User {
// id: usize,
// login: UserLogin,
// password: String,
@scooter-dangle
scooter-dangle / __fish_aws_creds_prompt.fish
Created January 23, 2020 04:28
Lightweight AWS env loader for fish
# AWS_ENV var is meant to be combined with the following
# function in the shell prompt
function __fish_aws_creds_prompt
if set --query AWS_ENV
if string match --ignore-case --quiet --regex 'pro?d' "$AWS_ENV"
set aws_name_color brred
else
set aws_name_color bryellow
end
@scooter-dangle
scooter-dangle / lib.rs
Created July 1, 2016 21:50
Subvector matching performance experimentation
// Winner! The others are about 45% slower on the contrived example
fn is_substring(needle: &[u8], haystack: &[u8]) -> bool {
if needle.is_empty() { return true }
// if haystack.len() < needle.len() { return false }
// if haystack.is_empty() { return false }
haystack.windows(needle.len()).any(|subvec| subvec == needle)
}
@scooter-dangle
scooter-dangle / main-1.rs
Last active November 10, 2017 03:43
Rust Talk Pretty One Day—BigRational to_rational
extern crate num;
use num::rational::{Ratio,Rational,BigRational};
use num::traits::ToPrimitive;
fn to_rational(number: BigRational) -> Option<Rational> {
let denom = number.denom().to_isize();
if denom == None {
return None
}
@scooter-dangle
scooter-dangle / CollectionsDemo.clj
Last active September 3, 2015 00:50 — forked from neilchaudhuri/CollectionsDemo.clj
Clojure code to perform operations on collections.
(->> (data)
(filter even?)
(map #(* 3 %))
(reduce +))
@scooter-dangle
scooter-dangle / expressable_demo.rb
Last active August 29, 2015 14:27
Demo of emulating template capture/block expression outside of ActionView / Rails environment
require 'erb'
require 'active_support/concern'
module Expressable
def with_tmp_buffer(&block)
tmp_buffer, @output_buffer = @output_buffer, ""
block.yield
@output_buffer
ensure
tmp_buffer, @output_buffer = @output_buffer, tmp_buffer
@scooter-dangle
scooter-dangle / alias_tables_issue.rb
Last active August 29, 2015 14:14
Illustration of error in AliasTable initialization
#!/usr/bin/env ruby
#
# To be run from inside the AliasTables directory
#
require './lib/alias'
normalize = -> ary do
sum = ary.inject(0.0, :+)
ary.map { |elmt| elmt.to_f / sum }

Keybase proof

I hereby claim:

  • I am scooter-dangle on github.
  • I am scottlsteele (https://keybase.io/scottlsteele) on keybase.
  • I have a public key whose fingerprint is D0B8 B301 5EA6 B2BA B2E8 C064 AEC3 67AF C5DA D548

To claim this, I am signing this object:

@scooter-dangle
scooter-dangle / gist:11181924
Last active August 29, 2015 14:00
rbenv install 1.8.7-p375—failed during rubygems install on Ubuntu 13.10

Command

~/e/jarvis (master|✚2…)> rbenv install 1.8.7-p375

Console output

Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7...
Installing ruby-1.8.7-p375...