Skip to content

Instantly share code, notes, and snippets.

View ashleymavericks's full-sized avatar
⛏️
Tinkering with RasPi's

Anurag Singh ashleymavericks

⛏️
Tinkering with RasPi's
View GitHub Profile

Understanding this in JavaScript

It's easy to trip up on the meaning of this in JavaScript. The behavior is very different from other languages, which means we have to throw most preconceptions and intuition out the window.

The best way to think of this in JS is as a hidden function argument which is passed in a slightly awkward way. Instead of the normal passing of arguments:

fn(arg1, arg2, arg3)
@vijayksingh
vijayksingh / list.md
Created October 1, 2022 06:50
Youtube Hidden Gem
@mayneyao
mayneyao / notion_api.js
Created February 18, 2019 09:59
Notion API
const axios = require('axios')
const { URLSearchParams } = require('url')
const getFullBlockId = (blockId) => {
if (typeof blockId !== 'string') {
throw Error(`blockId: ${typeof blockId} must be string`)
}
if (blockId.match("^[a-zA-Z0-9]+$")) {
return blockId.substr(0, 8) + "-"
+ blockId.substr(8, 4) + "-"
@jamescalam
jamescalam / flask_api.py
Last active August 24, 2023 07:50
A example API using Flask
from flask import Flask
from flask_restful import Resource, Api, reqparse
import pandas as pd
import ast
app = Flask(__name__)
api = Api(app)
class Users(Resource):
def get(self):
@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

@melvic-ybanez
melvic-ybanez / what-i-didnt-know-about-fp-2020.md
Last active December 29, 2023 18:32
What I Didn't Know about Functional Programming until 2020

What I Didn't Know about Functional Programming until 2020

  1. Programming using a series of transformations and aggregations, something I've been doing for years, is known as programming in the map/reduce style.
  2. The more abstract the type is, the greater its cardinality, and the smaller the set of operations it supports. So make use of universal quantifiers, particularly by implementing fully parametric functions. They guide you on how to implement their term-level definitions by narrowing down the number of possible implementations. In other words, the type system of Scala (or Haskell, for that matter) is not only great for capturing compile-time errors, but is also capable of leading you to the correct solution.
  3. You can encode union types by combining different Scala features such as type constructors, subtyping and implicits, and by taking advantage of the Curry-Howard Isomorphism and De Morgan's Laws for neg
@bmorrisondev
bmorrisondev / notion-sync.py
Created March 2, 2021 22:16
Sync Todoist Tasks to a Notion Database
from notion.client import NotionClient
import requests
import schedule
import time
from datetime import datetime
def get_todoist_tasks():
token = "todoist_token"
headers = {