Skip to content

Instantly share code, notes, and snippets.

View nickpreston24's full-sized avatar
🏠
Working remote

Nicholas Preston nickpreston24

🏠
Working remote
View GitHub Profile
@karenpayneoregon
karenpayneoregon / DateTimeHelpers.cs
Last active March 16, 2025 19:12
How AI can assist a developer
public static class DateTimeHelpers
{
/// <summary>
/// Generates a list of dates representing the next week's dates starting from the upcoming Sunday.
/// </summary>
/// <returns>A list of <see cref="DateOnly"/> objects representing the dates of the next week.</returns>
public static List<DateOnly> NextWeeksDates()
{
var start = DateTime.Now;
var nextSunday = DateOnly.FromDateTime(start).Next(DayOfWeek.Sunday);
@nickpreston24
nickpreston24 / curl.sh
Created March 31, 2024 14:21 — forked from FylmTM/curl.sh
Neo4j curl call example
#!/bin/bash
QUERY=query.json
time curl -i -XPOST \
-o output.log \
--data "@$QUERY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
http://127.0.0.1:7474/db/data/transaction/commit
@Braden-Preston
Braden-Preston / app.css
Last active November 14, 2023 04:45
Tailwind Web Component
z-counter::part(root) {
@apply font-bold flex flex-col gap-2 items-center text-gray-600;
}
z-counter::part(count) {
@apply text-4xl leading-none;
}
z-counter::part(title) {
@apply max-w-fit text-lg flex gap-4;
@Braden-Preston
Braden-Preston / form.go
Created October 24, 2023 03:15
Custom Go Type with Marshallers
package form
import (
"encoding/json"
"gopkg.in/guregu/null.v4/zero"
)
type OptionalText string
@neisdev
neisdev / index.html
Created August 7, 2022 08:17
Kanban Board with TailwindCSS and AlpineJS
<body class="antialiased sans-serif bg-gray-300">
<!-- Alert Box -->
<div class="fixed w-full z-50 flex inset-0 items-start justify-center pointer-events-none md:mt-5" x-data="{
message: '',
showFlashMessage(event) {
this.message = event.detail.message;
setTimeout(() => this.message = '', 3000)
}
}">
<template x-on:flash.window="showFlashMessage(event)"></template>
@DazzGranto
DazzGranto / range.js
Last active May 29, 2024 01:31
Range in JavaScript (Sequence generator)
// Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc)
const range = (start, stop, step = 1) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
// Generate numbers range 0..4
range(0, 4);
// [0, 1, 2, 3, 4]
// Generate numbers range 1..10 with step of 2
range(1, 10, 2);
// [1, 3, 5, 7, 9]
Column A Column B Column C Formula
1 2 5 =SUM(A2:C2)
5 3 10 =A3*C3+B3
2 2 4 =COUNTIF(A:C,2)
0 0 No =IF(and(A5=0,B5=0,C5="Yes"),1,0)
0 0 Yes =IF(and(A6=0,B6=0,C6="Yes"),1,0)
1 0 1 =IF(AND(A7=1,B7=0),"UPDATE",IF(AND(A7=0,B7=1),"CHECK","No Change"))
0 1 1 =IF(AND(A8=1,B8=0),"UPDATE",IF(AND(A8=0,B8=1),"CHECK","No Change"))
0 0 0 =IF(AND(A9=1,B9=0),"UPDATE",IF(AND(A9=0,B9=1),"CHECK","No Change"))
@nickpreston24
nickpreston24 / Document Import Design
Created February 6, 2020 08:25
Scratch of the Document Import I'm working on.
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace DocImportStrategies
{
class Program
{
static void Main(string[] args)
{
@fabean
fabean / docker-compose-base-setup.yaml
Last active August 9, 2024 13:17
Docker-compose for tutorial blog post
version: '2'
services:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy:alpine
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
@cmstead
cmstead / gist:7ad64539d13dfdb5a2591bc3be3c8eeb
Last active July 17, 2025 20:13
VS Code snippet transform: convert camel case to Pascal case or vice versa
// If you want to convert a PascalCase variable to camelCase, you can do the following:
// Where `n` is the tab stop you want to reference
${n/^(.)(.*)$/${1:/downcase}${2}/}
// Example: ${1:This is my original} => ${1/^(.)(.*)$/${1:/downcase}${2}/}
// If you want to convert a camelCase variable to PascalCase, you can do the following:
// Where `n` is the tab stop you want to reference
${n/^(.)(.*)$/${1:/upcase}${2}/}