Skip to content

Instantly share code, notes, and snippets.

View jbenner-radham's full-sized avatar

James Benner jbenner-radham

View GitHub Profile
@rust-play
rust-play / playground.rs
Created January 10, 2020 21:54
Code shared from the Rust Playground
use core::iter::once;
fn main() {
println!("{:?}", fmap(|x| x + 1, 1..100000));
}
fn fmap<A, B>(f: impl Fn(A) -> B, mut foo: impl Iterator<Item=A>) -> Vec<B> {
match foo.next() {
Some(x) => once(f(x)).chain(fmap(f, foo)).collect(),
None => Vec::new()
@rust-play
rust-play / playground.rs
Created January 10, 2020 21:53
Code shared from the Rust Playground
use core::iter::once;
fn main() {
println!("{:?}", fmap(|x| x + 1, 1..100000));
}
fn fmap<A, B>(f: impl Fn(A) -> B, mut foo: impl Iterator<Item=A>) -> Vec<B> {
match foo.next() {
Some(x) => once(f(x)).chain(fmap(f, foo)).collect(),
None => Vec::new()
@ksemel
ksemel / diffmerge.sh
Created January 10, 2020 21:50
Bash: Check for diffs, and only open the merge tool if diffs are found.
#!/bin/bash
#
# Check for diffs, and only open the merge tool if diffs are found.
#
dir=$FIRSTDIRECTORY
dir2=$SECONDDIRECTORY
cd "$dir"

If you add the following CSS rule:

details > details {
  padding-left: 20px;
}

The following markup becomes a nested outline view:

@wxgeorge
wxgeorge / yk-tech.2020-01-09.md
Created January 10, 2020 21:50
Yukon Tech Collective January 2020 meetup notes

We investigated the tool jq.

Wes first encountered this as a query tool for JSON. Our probing with the tool lead us to believe that it is much more than this.

This author intends to investigate JSONPath in the future, as it feels targetted specifically at querying. jq is capable of arbitrary JSON transformations. There is also JMESpath which is described as query language for JSON (this author was under the impression JMESpath was also capable of JSON transformations, albeit a more limited set than jq allows for the expression of)

First we needed some JSON. @ryanagar noted the considerable breadth of Yukon GIS data. With the help of a query builder, we were able to pull down a blob, and the task for the group was to investigate it's structure w

@song2010
song2010 / PY0101EN-2-3-Dictionaries.ipynb
Created January 10, 2020 21:44
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# list enabled
# pm list packages -e
# list disabled
# pm list packages -d
# disable
# pm disable-user --user 0 <package>
# enable
; nasm -felf64 a.asm && ld -o a.out a.o
; then
; gdb a.out
section .data
; initialize some data
someValue dq 8
initialTable dq 40, 871, 181, 157, 268, 790, 310, 211
fileName db "zaliczenie.txt"
@skaur7
skaur7 / PY0101EN-2-1-Tuples.ipynb
Created January 10, 2020 21:37
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpitt
cpitt / memoizeLocalStorage.js
Last active May 3, 2024 03:58
Memoize a function using local storage as it's cache
/**
* memoizes a function using localStorage as the cache
* @param {function|Promise} fn function or promise you wish to memoize
* @param {Object} [options] additional configuration
* @param {number} [options.ttl=0] time to live in seconds
* @param {Boolean} [options.backgroundRefresh=false] whether the cache should be refreshed asynchronously,
* Note: new results won't resolve until next execution
* @return {Promise} Promise object represents memoized result
*/
function memoizeLocalStorage(