Skip to content

Instantly share code, notes, and snippets.

@marcandrewb
marcandrewb / for of | for in Cheatsheet.md
Created December 14, 2017 16:22
for of | for in Cheatsheet
  • for...in iterates over the enumerable properties of an object
  • for...of iterates over the property values of objects
let myString = "test";

// logs 0, 1, 2, 3
for (let i in myString) {
  console.log(i);
}
@marcandrewb
marcandrewb / node-cheatsheet.js
Last active May 31, 2018 09:39
NodeJS Cheatsheet
/* *******************************************************************************************
* SYNOPSIS
* http://nodejs.org/api/synopsis.html
* ******************************************************************************************* */
var http = require('http');
// An example of a web server written with Node which responds with 'Hello World'.
// To run the server, put the code into a file called example.js and execute it with the node program.
@marcandrewb
marcandrewb / visual-code-cheatsheet.md
Last active December 30, 2019 15:03
Visual Code Cheatsheet

⌘ - Cmd
⌥ - Option
⇧ - Shift

Key Description
F12 Peek at definition
Move line down
Move line up
⌘ Enter when opening a file via quick open (⌘ P): Opens file in new split editor
// `ontouchstart` check works on most browsers
// `maxTouchPoints` works on IE10/11 and Surface
export function isTouchDevice() {
if (!window) return false;
return 'ontouchstart' in window || navigator.maxTouchPoints;
}
+-------+-----------+----------------------------------------+
| stage | name | mission |
+-------+-----------+----------------------------------------+
| 0 | strawman | Present a new feature (proposal) |
| | | to TC39 committee. Generally presented |
| | | by TC39 member or TC39 contributor. |
+-------+-----------+----------------------------------------+
| 1 | proposal | Define use cases for the proposal, |
| | | dependencies, challenges, demos, |
| | | polyfills etc. A champion |
@marcandrewb
marcandrewb / cron.md
Last active March 3, 2024 17:51
cron syntax

cron syntax

* * * * *  command to be executed
- - - - -
| | | | |
| | | | +----- Day of the week (0 - 7) (Sunday is 0 or 7)
| | | +------- Month (1 - 12)
| | +--------- Day of the month (1 - 31)
| +----------- Hour (0 - 23)
@marcandrewb
marcandrewb / tab-hidden.js
Created April 2, 2019 14:08
fire an event when a user makes another tab or window active
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
// the page has been hidden
} else {
// the page has become visible
}
});
export function isElementInView(container: HTMLElement, element: HTMLElement, partial: boolean) {
if (!container || !element) {
return false;
}
const containerBounds = container.getBoundingClientRect();
const elementBounds = element.getBoundingClientRect();
const containerBoundsLeft = Math.floor(containerBounds.left);
const containerBoundsRight = Math.floor(containerBounds.right);
const elementBoundsLeft = Math.floor(elementBounds.left);
const elementBoundsRight = Math.floor(elementBounds.right);

Awesome Personalization

A curated list of hand-picked resources about personalization inspired by the awesome-* trend on GitHub.

The goal is to build a categorized, community-driven collection of excellent resources on the topic. I've been on a steep learning curve on personalization since I founded Croct, so I tried to catalog my resources to help others.

Want to contribute to growing or improving this? Sharing, suggestions, and contributions are always welcome! Please take a look at the contribution guidelines first.

Basics (Start Here)