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
@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
@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]
@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)
{
@cmstead
cmstead / gist:7ad64539d13dfdb5a2591bc3be3c8eeb
Last active March 3, 2024 06:40
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}/}
@boseji
boseji / Manjaro-tricks.md
Last active October 14, 2023 01:06
Manjaro Linux : Tips and Tricks (ARCH Linux under the hood)

Manjaro Linux : Tips and Tricks

We have been using [Manjaro linux][2] for past year and have been happy with its perfomance. Though we don't use te [AUR][1] (Arch User Repository, since many are not supported into Manjaro.

The best part is even with bad / dumb users like myself, IT-DOES-NOT-BREAK. So, we very much recommend [Manjaro][2].

It seriously worked much better than Ubuntu. We might not be able to have all the boat load of software & support like Debian, but we are happy.

@bradtraversy
bradtraversy / docker_wordpress.md
Last active July 11, 2024 00:07
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@adam-cowley
adam-cowley / index.js
Created March 2, 2018 16:24
Neo4j Driver as an Express Middleware
// Create an express app
const express = require('express');
const app = express();
// Tell it to use Neo4j middleware
app.use(require('./neo4j'));
// Example Route
app.get('/', (req, res) => {
// Create Driver session
@dadhi
dadhi / FreeIOMonad.cs
Last active October 9, 2022 03:05
Example of Free IO monad in pure C# with separated re-usable monad implementation
/*
Modified from the original https://gist.github.com/louthy/524fbe8965d3a2aae1b576cdd8e971e4
- removed dependency on [language-ext](https://github.com/louthy/language-ext)
- separated monadic boilerplate, so you may concentrate on describing the operations and interpretation of the program
- removed `IO<A>.Faulted` to simplify the examples. It can be added back in straightforward manner.
Useful links:
- [John DeGoes: Beyond Free Monads - λC Winter Retreat 2017](https://www.youtube.com/watch?v=A-lmrvsUi2Y)
- [Free and tagless compared - how not to commit to a monad too early](https://softwaremill.com/free-tagless-compared-how-not-to-commit-to-monad-too-early)