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');
| /* require */ | |
| var gulp = require('gulp'), | |
| browserSync = require('browser-sync'), | |
| reload = browserSync.reload, | |
| sass = require('gulp-ruby-sass'), | |
| plumber = require('gulp-plumber'), | |
| rename = require('gulp-rename'), | |
| uglify = require('gulp-uglify'), | |
| minifyCss = require('gulp-minify-css'), | |
| imagemin = require('gulp-imagemin'), |
| abusaidm.html-snippets | |
| akamud.vscode-theme-onedark | |
| alefragnani.Bookmarks | |
| alefragnani.project-manager | |
| Angular.ng-template | |
| anseki.vscode-color | |
| anthonydiametrix.ACF-Snippet | |
| burkeholland.simple-react-snippets | |
| buzatto.ionic-basic-pack | |
| christian-kohler.npm-intellisense |
| 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; | |
| <?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']); | |
| } | |
| /** |
| 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(() => { |
| # ---------------------------------------------------------------------- | |
| # Rewrites / permalinks | |
| # ---------------------------------------------------------------------- | |
| # ---------------------- | |
| # BEGIN WordPress | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteBase /blog/ | |
| RewriteRule ^index\.php$ - [L] |
| # 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 |
| <?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 ) ); |
| <!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> |