Skip to content

Instantly share code, notes, and snippets.

View krvajal's full-sized avatar
:electron:
What's happening?

Miguel Carvajal krvajal

:electron:
What's happening?
  • @wearesinch
  • Antwerpen, Belgium
View GitHub Profile
@jg-rp
jg-rp / assignment_expression.bnf
Last active September 9, 2023 21:34
Liquid template expression syntax
expression : ID "=" filtered
filtered : left { "|" filter }
left : literal
| path
| range
literal : FLOAT
| INTEGER

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@kentcdodds
kentcdodds / object.entries.js
Last active November 7, 2020 23:36
Example of using Object.entries
// http://www.dogbreedchart.com
const dogShedding = {
foxhound: 3,
'basset hound': 2,
beagle: 3,
'bernese mountain dog': 1,
poodle: 5,
}
// 🔥🔥
@bensie
bensie / imagemagick.bash
Last active June 24, 2024 12:21
ImageMagick Static Binaries for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of May 21, 2019, this is:
# Amazon Linux AMI 2018.03.0 (ami-0756fbca465a59a30)
#
# You need to prepend PATH with the folder containing these binaries in your Lambda function
# to ensure these newer binaries are used.
@justmoon
justmoon / custom-error.js
Last active June 26, 2024 09:36 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>