Skip to content

Instantly share code, notes, and snippets.

View Walexander's full-sized avatar

Will Alexander Walexander

  • MCO
  • Tysons Corner, VA
View GitHub Profile
@Walexander
Walexander / effect-prime-stream.ts
Last active February 15, 2023 14:34
Prime number sieve using Effect streams
import * as Stream from '@effect/stream/Stream'
import * as Chunk from '@effect/data/Chunk'
import * as IO from '@effect/io/Effect'
import { pipe } from "~/lib";
const intsPlusPrimality = pipe(
Stream.range(1, Number.MAX_SAFE_INTEGER),
Stream.mapAccum(Chunk.empty<number>(), sieveChunk),
Stream.flatten
)
@Walexander
Walexander / listr.ts
Created September 11, 2022 18:40
Recursion Schemes For Dynamic Programming: TS-Plus Edition
import type * as P from "@tsplus/stdlib/prelude/Covariant"
import type { Unfolder } from "@tsplus/stdlib/prelude/Recursive"
// Type definitions
export type MyNonEmptyList<A> = Leaf<A> | Node<A>
export type Carrier<A> = Tuple<[A, A]>
export interface ListF extends HKT {
readonly type: MyNonEmptyList<this["A"]>
}
export const Functor: Covariant<ListF> = HKT.instance<P.Covariant<ListF>>({
@Walexander
Walexander / carousel.html
Created August 29, 2018 17:51
Flex Box Carousel W Scroll Snapping
function load(url) {
return new Promise( function(resolve, reject) {
var d= document.createElement('script')
d.src = url
d.addEventListener('onload', onload, true)
document.body.appendChild(d)
function onload(e) {
var a = {
foo: [ 'foo1', 'foo2' ],
bar: [ 'bar1', 'bar2' ],
}
Object.keys( a ).map( (list) => a[list] )
.reduce( (accum, current) => {
return accum.then( () => {
var promises = current.map( (url) => load(url) )
<script type="text/javascript">
(function() {
// Handle #OldIE versions which do not contain the `CustomEvent` API
var CustomEvent = typeof window.Event == 'function' ? window.CustomEvent : CustomEventPolyfill
// The event details can contain a `slot_list` property, a space-separated list
// of site/section@size slots to run an auction for. If this property is missing
// or the value is empty, the slots specified in the nucleus element itself are used
var slotList = {
<script id="cx-nuke"
src="//c.mbid.io/tags/h"
data-bsm-pub="testpub"
data-bsm-sizes="300x250 728x90"
data-bsm-pub-zone="testpub.com/ros"
data-bsm-slot-list="testpub.com/ros@300x250 testpub.com/ros@728x90"
data-bsm-key1="value1"
data-bsm-key2="value2.0 value2.1"
></script>

Keybase proof

I hereby claim:

  • I am Walexander on github.
  • I am serverherder (https://keybase.io/serverherder) on keybase.
  • I have a public key whose fingerprint is 6C97 0623 5ABD E1AD 8B8A A020 7845 D819 5106 91EE

To claim this, I am signing this object:

commit b106d7c9acf4038095a996ea55891f1fb1b5d228
Author: Will Alexander <will@beanstockmedia.com>
Date: Wed Dec 10 13:59:18 2014 -0500
unit/manifest: unit tests for #getBest() method
diff --git a/test/unit/manifest.manifest.js b/test/unit/manifest.manifest.js
index 720f931..c3320c4 100644
--- a/test/unit/manifest.manifest.js
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdtree'
Bundle 'altercation/vim-colors-solarized'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-dispatch'
Bundle 'pangloss/vim-javascript'
Bundle 'jelera/vim-javascript-syntax'
Bundle 'mklabs/grunt.vim'