Skip to content

Instantly share code, notes, and snippets.

View indefinitelee's full-sized avatar

Lee Wilson indefinitelee

View GitHub Profile
@hwayne
hwayne / allen.md
Created June 30, 2021 20:10
Frances Allen

A while back I complained on Twitter about how Ada Lovelace is used as an example of "an important woman in CS", because she's a pretty terrible example (thread in comments), and listed some better choices. In response, somebody said that public people get why Lovelace is interesting, whereas it's hard to explain why, like, Barbara Liskov matters so much. That got me interested in explaining the contributions to CS in ways that are understandable to people with no tech background. Here's my attempt to explain Frances E Allen, who did foundational work in optimizing compilers:


Without Frances Allen, our videogames would be stuck in the SNES era.

So at a fundamental level, a computer is just a bag of buckets of data (memory addresses), and a program is just instructions ot move data between the buckets. Like mov edx, [ebp + 8] means "take the data in the 8th bucket after the ebp bucket and move it to the edx bucket." All programs eventually become this "assembly" language that the computer execut

@bennettscience
bennettscience / iterator.js
Last active September 18, 2021 22:18
Use a JS generator to create an iterator for paginated API responses
'use strict'
/**
* Objeect Oriented implementation of an iterable to handle paginated requests
*
* @param {string} requestMethod HTTP method for the request
* @param {string} firstUrl Endpoint for the request
*
*/
class PaginatedList {
constructor(requestMethod, firstUrl) {
@taniarascia
taniarascia / auth.md
Last active February 11, 2024 23:16
JavaScript Authentication & Authorization Book/Course

Authentication in Real-World Web Apps with JavaScript

Outline of ideas, concepts to cover, potential projects to write.

Setup Idea

  • Book with a video for each chapter.

Prerequisites/Overview

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@jesperorb
jesperorb / php_form_submit.md
Last active April 30, 2024 22:27
PHP form submitting with fetch + async/await

PHP Form submitting

If we have the following structure in our application:

  • 📁 application_folder_name
    • 📄 index.php
    • 📄 handle_form.php
    • 📄 main.js

And we fill our index.php with the following content just to get a basic website with a form working. You should be able to run this through a php-server of your choice.

@cklanac
cklanac / knexjs.joins.md
Created February 6, 2018 10:50
Knex.js Joins

Adding Knex to the endpoints

Now that you have a good understanding of the Knex's capabilities, let's look at adding Knex to our Express app endpoints. Quit the nodemon drills.js process and start the server.

Open Postman and navigate to http://localhost:8080/restaurants. You should get back a list of restaurants. The SELECT statement is straight forward, the only thing to point out is the addition of in the `.then(results => res.json(results) );

Inner Join

Let's tackle the grade first.

@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin

GitHub team organization

Pick a member of the team as the responsible party to manage the organization. For now I'll refer to him as the GitHub Lead.

Create an organization

  • Github Lead responsibility
  • The organization name has to be unique in github

Add team members as organization members

@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default: