Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.
$ npm install mongoose --save
const mongoose = require('mongoose');
// background: linear-gradient( | |
// hsl(359, 100%, 100%) 0%, | |
// hsla(359, 100%, 100%, 0.738) 19%, | |
// hsla(359, 100%, 100%, 0.541) 34%, | |
// hsla(359, 100%, 100%, 0.382) 47%, | |
// hsla(359, 100%, 100%, 0.278) 56.5%, | |
// hsla(359, 100%, 100%, 0.194) 65%, | |
// hsla(359, 100%, 100%, 0.126) 73%, | |
// hsla(359, 100%, 100%, 0.075) 80.2%, | |
// hsla(359, 100%, 100%, 0.042) 86.1%, |
// Define the breakpoints | |
$breakpoint-small: 600px; | |
$breakpoint-med-small: 960px; | |
$breakpoint-med: 1175px; | |
@mixin screen($size, $type: max, $pixels: $breakpoint-small) { | |
@if $size == 'small' { | |
@media screen and ($type + -width: $breakpoint-small) { | |
@content; |
<!doctype html> | |
<html> | |
<head> | |
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<meta charset="UTF-8"> | |
<title>Example Google Map</title> | |
</head> | |
<body> | |
<div id="map-canvas" style="height:400px; width:600px;"></div> | |
<script> |
<?php | |
add_action( 'wp_ajax_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_{action} for registered user | |
add_action( 'wp_ajax_nopriv_ajaxcomments', 'ugwps_submit_ajax_comment' ); // wp_ajax_nopriv_{action} for not registered users | |
function ugwps_submit_ajax_comment(){ | |
$comment = wp_handle_comment_submission( wp_unslash( $_POST ) ); | |
if ( is_wp_error( $comment ) ) { | |
$error_data = intval( $comment->get_error_data() ); | |
if ( ! empty( $error_data ) ) { | |
wp_die( '<p>' . $comment->get_error_message() . '</p>', __( 'Comment Submission Failure' ), array( 'response' => $error_data, 'back_link' => true ) ); |
# Installation --- | |
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables. | |
# 2. Commit this file to your repo | |
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will | |
# push everything and initial GitFTP) | |
# | |
# Usage --- | |
# - On each commit to master branch, it'll push all files to the $FTP_HOST | |
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises | |
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you |
# ---------------------------------------------------------------------- | |
# Rewrites / permalinks | |
# ---------------------------------------------------------------------- | |
# ---------------------- | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /blog/ | |
RewriteRule ^index\.php$ - [L] |
let pageNumber = 2; | |
const MAX_PAGES_TO_GO_THROUGH = 10; | |
function scrollToBottom() { | |
window.scrollTo(0,document.body.scrollHeight); | |
} | |
function goToNextPage() { | |
document.querySelector('[aria-label="Page '+ pageNumber +'"]').click(); | |
setTimeout(() => { |
<?php | |
class ContactFormProcessing | |
{ | |
protected $action = 'contact_form'; | |
public function ajaxInit() | |
{ | |
add_action("wp_ajax_{$this->action}", [$this, 'process']); | |
add_action("wp_ajax_nopriv_{$this->action}", [$this, 'process']); | |
} | |
/** |
document.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |