Skip to content

Instantly share code, notes, and snippets.

Variables:
Avoid global variables:
Variables can be accessed in local scope or global scope.
Local and global variable with the same name => javascript will prioritize the local variable.
Local variables are deleted once the local execution context is complete. Global variables
References
Use const or let for references
Avoid using var (https://developer.mozilla.org/en-US/docs/Glossary/Hoisting)
@getify
getify / 1-post.md
Last active February 27, 2023 00:23
Comparing: array method chaining, generator delegations, and transducing

Comparing: array method chaining, generator delegations, and transducing

I'm writing this quick post to respond to a recent twitter conversation where claims were made about the merits (or lack thereof) of transducers, as they relate to composing list comprehensions (map, filter).

For comparison sake throughout the rest of my post, below you'll find three (actually four!) implementations of a simple list operation demo:

@reinvanoyen
reinvanoyen / terminal-prompt-git-branch-zsh.md
Last active April 12, 2024 22:18
Add Git Branch Name to Terminal Prompt (MacOS zsh)

Add Git Branch Name to Terminal Prompt (zsh)

Updated for MacOS with zsh

  • Catalina
  • Big Sur
  • Monterey
  • Ventura
  • Sonoma

screenshot

@nzaghini
nzaghini / Movie-test.js
Last active September 23, 2022 17:03
Apollo GraphQL Test Example with Jest
import fs from 'fs'
import { makeExecutableSchema } from 'graphql-tools'
import { graphql } from 'graphql'
// the actual resolvers
import resolvers from '../src/resolvers'
// the mock service
import mockMovieService from './mocks/mockMovieService'
// a nice structure for test cases
// found at https://hackernoon.com/extensive-graphql-testing-57e8760f1c25
@f0ster
f0ster / slack_history.py
Last active November 8, 2019 01:25
slack history downloader (pub and priv) with rate limit retry :)
#https://gist.github.com/Chandler/fb7a070f52883849de35 SEE HERE
# MIT License
# Copyright (c) 2016 Chandler Abraham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@mlanett
mlanett / rails http status codes
Last active April 13, 2024 13:40
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing