Skip to content

Instantly share code, notes, and snippets.

@wittyprogramming
wittyprogramming / form-validator.mjs
Last active May 2, 2022 19:32
Form Validation using Alpine.js framework applying a Vue composition-like architecture.
import {
isEmail,
isMaxLength,
isMinLength,
isRequired,
} from "./validators.mjs";
export function formValidator() {
let submitBackend;
return {
@wittyprogramming
wittyprogramming / index.html
Created October 29, 2020 19:33
Netlify Form by using Alpine.js. Implement honeypot, Recaptcha, client-based validation, and AJAX (fetch) submission.
<form
hidden
name="contact"
method="POST"
data-netlify="true"
netlify-honeypot="bot-field"
data-netlify-recaptcha="true"
>
<label><input type="text" name="name" /></label>
<label> <input type="email" name="email" /></label>
<?php
class Db
{
private $_connection;
private static $_instance; //The single instance
private $_host = DB_HOST;
private $_username = DB_USER;
private $_password = DB_PASSWORD;
private $_database = DB_DB;
@bastianallgeier
bastianallgeier / controllers--contact.php
Created October 1, 2014 19:36
Plain contactform example for Kirby 2
<?php
return function($site, $pages, $page) {
$alert = null;
if(get('submit')) {
$data = array(
'name' => get('name'),
@brock
brock / nodereinstall.sh
Last active March 27, 2025 16:22
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@jonashansen229
jonashansen229 / class.database.php
Last active June 20, 2023 08:41
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@fat
fat / gist:3744369
Created September 18, 2012 17:10
all you probably really need
/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;