Skip to content

Instantly share code, notes, and snippets.

th0r / angular-in-view-directives.html
Last active Feb 18, 2019
Angular `InView` directives
View angular-in-view-directives.html
<!-- wInViewRoot directive is needed to specify the `root` for `IntersectionObserver` and some other it's options e.g. `margin` -->
<div class="container" wInViewRoot="viewport">
Any content can be here
<!-- Content will be replaced by a placeholder <div> with the same height as original content.
Also `InViewItemComponent`s change detector will be detached when it become invisible which means
all the content's change detectors won't be reachable and will be inactive as well. -->
...or any other content can be here
CelliesProjects / structToFile.ino
Last active Mar 27, 2021
Read and write a c++ struct to a file. Arduino IDE. ESP32.
View structToFile.ino
#include <FS.h>
#include <SPIFFS.h>
typedef struct {
char someString[10];
float someFloat;
} MyStruct;
OliverJAsh / foo.ts
Last active Nov 7, 2019
TypeScript URL helpers
View foo.ts
import urlHelpers, { Url, UrlWithParsedQuery, UrlWithStringQuery } from 'url';
import queryStringHelpers from 'querystring';
import { Option } from 'funfix-core';
import pipe from 'lodash/flow';
import { ParsedUrlQuery } from 'querystring';
const isNonEmptyString = (str: string) => str.length > 0;
const flipCurried = <A, B, C>(fn: (a: A) => (b: B) => C) => (b: B) => (a: A) =>
ivenmarquardt / lazy-evaluation.js
Last active May 18, 2018
Lazy evaluation, lazy getters, eta reduction, function composition, implicit thunks through deferred type
View lazy-evaluation.js
// Lazy Getters
/* What enables Tail Recursion Modulo Cons in Javascript is a thunk in Weak Head Normal Form.
An expression in weak head normal form has been evaluated to the outermost data constructor,
but contains sub-expressions that may not have been fully evaluated. In Javascript only thunks
can prevent sub-expressions from being immediately evaluated. */
const cons = (head, tail) => ({head, tail});



  • ✏️ method changes this.
  • 🔒 method does not change this.


  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
View demo.ts
ngOnInit() {
this.filteredRoutes$ = from(this.routes).pipe(
concatMap((route) => {
// handle if nothing is in canActivate
if (!route.canActivate || !route.canActivate.length) {
// create an object that has the route and result for filtering
return of({ route, result: true });
return from(route.canActivate).pipe(
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
mpilosov /
Last active Apr 7, 2021
Controlling Machines with GRBL

Instructions for a machine with GRBL already on it

My machine (basically this build: has GRBL 0.9 : The documents for newer version are up there too, obviously. It would definitely be good to get v1.1 working in order to learn the process of getting it on a fresh Arduino board. I'll outline the process of how to do that in the section below this one and fill in the details as I get around to figuring them out. Here's what I do know for sure though...

Sending GCode to the Machine

You can use any number of GUIs but the premise is always the same. Once the firmware is on your board, connect it via USB, power it on, and search in your /dev/ directory for your Arduino (type that into Terminal and start typing "tty" and then hit Tab until something shows up). If you have the Arduino software, use the drop down menus to identify an address like /dev/ttyusb#### or /dev/wchusbserial#### The numbers will be u

qwtel / createTween.js
Last active Nov 6, 2018
rxjs5 tweening helper function. Creates a tween observable that emits samples from an easing function via requestAnimationFrame.
View createTween.js
import { Observable } from 'rxjs/Observable';
* Creates an observable that emits samples from an easing function on every animation frame
* for a duration `d` ms.
* The first emitted value will be a sample form the easing function at `t = 0`,
* and the last emitted value is guaranteed to be the easing function at `t = d`.
* It can be used with any of [Robert Penner's easing functions](,
gretel /
Last active Mar 29, 2021
query, read, encode (using amiitool), write and lock NTAG215 (using uFR Nano hardware) for the purpose of researching Nintendo's Amiibo infrastructure Raw
# This is a companion script to
# The original post this was crafted for was
# For more info go to
#sha1sum (part of coreutils)
#xxd (part of vim)
#amiitool (