Skip to content

Instantly share code, notes, and snippets.

@psxdev
psxdev / gist:c99eebd3c8b85f2eb7a288eee74cf4b1
Created June 11, 2022 21:45
Playing with bd-j on macos bigsur on m1
View gist:c99eebd3c8b85f2eb7a288eee74cf4b1
references https://hdcookbook.jovial.com/
the github project was updated for m1 last year:
https://github.com/zathras/java.net
1) You will need ant and java sdk
for java this is using 1.8, it is old stuff and the author update to build all fine on m1 so
java download zulu openjdk sdk 1.8.0_302 select 8u302b08 Azul Zulu: 8.56.0.23 form macos arm64 from:
https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk&show-old-builds=true
ant get the 1.10.12 version from:
https://ant.apache.org/bindownload.cgi
2)i choose the tar.gz option to place all in my custom directories, you can use a script like
@th0r
th0r / angular-in-view-directives.html
Last active February 9, 2023 17:45
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
<w-in-view-item>
<!-- 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. -->
</w-in-view-item>
...or any other content can be here
<w-in-view-item>
@CelliesProjects
CelliesProjects / structToFile.ino
Last active September 1, 2023 18:04
Read and write a c++ struct to a file. Arduino IDE. ESP32.
View structToFile.ino
/*
* EXAMPLE READING AND WRITING A C++ STRUCT TO A FILE
*/
#include <FS.h>
#include <FFat.h>
const char *fileName = "/somefile.txt";
struct aStruct {
char someString[11];
@OliverJAsh
OliverJAsh / foo.ts
Last active November 7, 2019 06:42
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;
// https://github.com/gcanti/fp-ts/blob/15f4f701ed2ba6b0d306ba7b8ca9bede223b8155/src/function.ts#L127
const flipCurried = <A, B, C>(fn: (a: A) => (b: B) => C) => (b: B) => (a: A) =>
@ivenmarquardt
ivenmarquardt / lazy-evaluation.js
Last active May 18, 2018 20:37
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});
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(
View remove-branches-no-remote.sh
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@mpilosov
mpilosov / GettingStartedWithGRBL.md
Last active May 26, 2023 19:22
Controlling Machines with GRBL
View GettingStartedWithGRBL.md

Instructions for a machine with GRBL already on it

My machine (basically this build: https://www.thingiverse.com/thing:1514145) has GRBL 0.9 : https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.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
qwtel / createTween.js
Last active November 6, 2018 18:18
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](http://robertpenner.com/easing/),