Skip to content

Instantly share code, notes, and snippets.

@fatbobman
fatbobman / adaptiveSheet.swift
Created October 22, 2022 00:53
Adaptive Height Sheet
import SwiftUI
struct ContentView: View {
@State var show = false
var body: some View {
VStack {
Button("Pop Sheet") { show.toggle() }
}
.adaptiveSheet(isPresent: $show) { SheetView() }
}
@rishitells
rishitells / Jest_GitLab_CI.md
Last active May 3, 2024 20:18
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@mecid
mecid / Calendar.swift
Last active May 5, 2024 08:43
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
@dferber90
dferber90 / visual-regression-testing.md
Last active July 2, 2023 08:45
Visual Regression Testing in Jest

Visual Regression Testing with Jest

This is a walkthrough of how to set up Visual Regression Testing with Jest for an application created with create-react-app.

The following walkthrough uses React as an example, but the approach should work for any modern frontend library! I assume it can be used with Angular, Vue, Cycle.js and more.

This gist walks you through a create-react-app application as an example of how to set up Visual Regression Testing in Jest using libraries I wrote recently which enable this: jsdom-screenshot, jest-transform-css and jest-transform-file.

@philmerrell
philmerrell / audio.service.ts
Created November 20, 2017 21:10
Angular audio service class
import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs/Rx';
@Injectable()
export class AudioService {
public audio: HTMLAudioElement;
public timeElapsed: BehaviorSubject<string> = new BehaviorSubject('00:00');
public timeRemaining: BehaviorSubject<string> = new BehaviorSubject('-00:00');
public percentElapsed: BehaviorSubject<number> = new BehaviorSubject(0);
@heppu
heppu / ARCH_INSTALL.MD
Last active February 27, 2022 17:01
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
@jakub-g
jakub-g / .profile
Last active September 12, 2022 19:47
npm run Win-compatible bash completion (for custom scripts defined in `package.json`)
#!/bin/bash
alias npmrun='npm run'
alias _npmscripts_print="node -e \"console.log(Object.keys(require('./package.json').scripts, null, ' ').join(' '))\""
_npmscripts_completion()
{
local cur=${COMP_WORDS[COMP_CWORD]}
opts=$( _npmscripts_print )
COMPREPLY=( $(compgen -W "${opts}" -- $cur) )
}
complete -F _npmscripts_completion npmrun
@brianclements
brianclements / Commit Formatting.md
Last active April 28, 2024 11:35
Angular Commit Format Reference Sheet

Commit Message Format

This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.