Skip to content

Instantly share code, notes, and snippets.

@daleyjem
daleyjem / LESS-SASS-Guidelines.md
Last active September 21, 2016 22:13
These are my personal preferences for keeping LESS/SASS code organized, modular and with low specificity.

LESS/SASS Guidelines

Structure. Structure. Structure

Make sure structure is organized and created in such a way that accommodates a large project by properly categorizing and modularizing folders and files. It’s better to feel that you’re over-engineering at the beginning, and restructure “down” later, than to assume a minimal set-up up front, simply for the sake of expediency.

Bad:

> less
	*all-of-the-files.less
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
ServerModule,
AppModule
],
@daleyjem
daleyjem / get-distinct-playlist-artists.js
Last active April 27, 2020 20:23
Get a distinct listing of all artists from a user's playlists using Apple Music API
const axios = require('axios')
const userToken = '<user token>'
const devToken = '<dev token>'
/**
* Gets a distinct array of the artists in a user's playlists
* @param {string} devToken The Apple-issued JWT developer token
* @param {string} userToken The returned Apple `musickit.authorize()` user token
*/
@daleyjem
daleyjem / deep-imports.md
Last active December 23, 2024 00:54
Explanation of a "deep import"

Deep Imports

Description

A "deep import" is simply an ESM import that goes deeper than the package root:

import thingA from 'my-package-name/src/components/thingA'
import thingB from '@my-namespace/my-package-name/src/components/thingA'
@daleyjem
daleyjem / yarn-silent-update.md
Last active February 8, 2023 21:05
How to add a caret to package.json versions without getting latest semver match

It doesn't make sense upon initial description reading, but there is a use case for it... Updating a package.json dependency to use a caret without getting the latest semver match.

I'm currently working on a very large project, in which we would like to enforce exact version matches across all child workspace package.json files.

Understand that when I say child workspace packages, you mustn't assume this project is a monorepo that publishes its packages. It uses yarn workspaces simply for the benefit of doing non-relative-path imports:

import { thing } from 'internal-package-a'
// vs