Skip to content

Instantly share code, notes, and snippets.

@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active May 10, 2024 19:51
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@tugascript
tugascript / paginated.interface.ts
Last active May 3, 2023 09:22
A Generic Paginated Type for GraphQL in NestJS code first approach
export interface IEdge<T> {
cursor: string;
node: T;
}
interface IPageInfo {
endCursor: string;
hasNextPage: boolean;
}
@adrienjoly
adrienjoly / fix-dyld-missing-symbol-called-errors-on-m1-macs.md
Last active February 3, 2024 18:01
Fix `dyld[]: missing symbol called` errors when running Node.js programs on M1 Macs (apple silicon)

Problem

If you're getting this kind of error when running Node.js programs with binary dependencies that don't support M1 yet, e.g.:

$ yarn test
dyld[51175]: missing symbol called
dyld[51176]: missing symbol called
@d3noob
d3noob / .block
Created June 18, 2021 23:41
v7 curve interpolation comparison
license: mit
@rakia
rakia / mat-dynamic-table.component.ts
Last active January 17, 2024 12:07
Material Dynamic Table Angular component - typescript part
/**
* Table component that accepts column and row definitions in its content to be registered to the table.
*/
@Component({
selector: 'mat-dynamic-table',
templateUrl: './mat-dynamic-table.component.html',
styleUrls: ['./mat-dynamic-table.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MatDynamicTableComponent<T> implements OnInit, OnChanges, AfterContentInit {
@LeZuse
LeZuse / 00_README.md
Last active April 22, 2024 15:06
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@tophtucker
tophtucker / README.md
Last active February 21, 2024 22:11
d3 color-legend example

In response to a question on Twitter by @everybody_kurts:

“Hi @mbostock, I was looking at your stacked area chart at https://observablehq.com/@d3/stacked-area-chart. At the end of the file, you import swatches from "@d3/color-legend". I tried finding this on npmjs but to no avail. Is this exclusive to @observablehq only?”

This shows how to use the swatches function from the @d3/color-legend notebook in a plain HTML page. The example data for the swatches (the color scale and margin) is copied from the @d3/stacked-area-chart notebook.

@AvocadoVenom
AvocadoVenom / bar-chart-tooltip.component.ts
Last active July 11, 2019 11:50
Adding a tooltip to d3 angular component
private tooltip: any; private total: number;
constructor(private service: DataService) {
// ...
this.total = this.dataSource.reduce((sum, it) => sum += it.abs, 0);
}
ngOnInit() {
// ...
this.tooltip = d3.select('#pie') // or d3.select('#bar')
@bvandenbon
bvandenbon / cookieservice.service.ts
Last active December 4, 2020 10:29
CookieService
import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
constructor() {
}
set(key: string, value: string): void;
set(key: string, value: string, expires: Date): void;
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DatabaseModule } from 'modules/database/database.module';
import { User } from 'modules/shared/entities/user.entity';
import { UserService } from './services/user.service';
@Module({
imports: [DatabaseModule, TypeOrmModule.forFeature([User], Config.get.databases.main.name)],
exports: [DatabaseModule, UserService],
providers: [UserService]