Skip to content

Instantly share code, notes, and snippets.

View brandonetter's full-sized avatar

Brandon Etter brandonetter

View GitHub Profile
@YourAKShaw
YourAKShaw / namaste_javascript_notes.md
Last active April 7, 2024 15:20
Namaste 🙏 JavaScript is a YouTube playlist by Akshay Saini. These are the notes I've made when I was learning JavaScript from Scratch using the playlist.

How JavaScript Works?

Is JavaScript:

  • Synchronous or Asynchronous?
  • Single-threaded or Multi-threaded?
  • Everything in JavaScript happens inside an Execution Context
    • You can assume this execution context to be a big box or a container in which the whole JavaScript code is executed.
  • This big box has two components in it:
@fnky
fnky / ANSI.md
Last active July 27, 2024 22:42
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@steveliles
steveliles / mentions-with-draft.js
Created September 20, 2017 12:47
Implementing @Mention's in Draft.js
const { Editor, EditorState, CompositeDecorator, Modifier, SelectionState } = Draft;
const getMentionPosition = () => {
const range = window.getSelection().getRangeAt(0).cloneRange();
const rect = range.getBoundingClientRect();
return { top: rect.bottom, left: rect.left }
}
const getCaretPosition = (editorState) => {
return editorState.getSelection().getAnchorOffset()
@samuelfvlcastro
samuelfvlcastro / 32bitpacking.js
Last active April 22, 2024 20:59
Example of a bit field in javascript. Packing RGBA values into a single 32bit integer
function logBinary(number){
console.log((number >>> 0).toString(2).replace(/(.{8})/g, " "));
}
var startBit = 8;
var bitsToGet = 8;
var alpha = 45;
var red = 187;
var green = 255;
var blue = 56;