Skip to content

Instantly share code, notes, and snippets.

View jessekanner's full-sized avatar

Jesse Kanner jessekanner

  • Los Angeles, CA
View GitHub Profile
@jessekanner
jessekanner / bootstrap-wordpress-wp_query.php
Last active August 13, 2021 22:51
Bootstrap-ready pagination with custom WP_Query
<ul class="list-unstyled news-list">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => '6',
'order' => 'DESC',
'orderby' => 'ID',
'paged' => $paged
);

How I spun up Laravel supporting SCSS using Sail from scratch

  • curl -s "https://laravel.build/my-cool-app" | bash
  • cd my-cool-app
  • Start up sail, and leave running in its own window sail up
  • In sep window: sail composer require laravel/breeze && sail artisan breeze:install
  • In same sep window: npm install && npm run dev
  • For SCSS support, added this to end of webpack.mix.js:
.sass("resources/sass/app.scss", "public/css")
// Correct Webpack config to enable SCSS compliation capabilities in Laravel/Mix Jetstream
// File to edit: [git-root]/webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
.scripts('resources/js/custom.js', 'public/js/custom.js')
.sass('resources/sass/app.scss', 'public/css')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
])
@jessekanner
jessekanner / php_ssh2_lib_path.md
Last active December 17, 2020 13:44
How to Install the PHP SSH2 Extension

From: https://hackerdise.com/how-to-install-the-php-ssh2-extension/

In this guide, we will show you how to rapidly install SSH2 aka libssh2 PECL PHP Extension for PHP5.x and PHP7.x series for cPanel and Cyberpanel.

Installing SSH2 on PHP 5.x and 7.0, 7.1, 7.2, 7.3 and 7.4(Cyberpanel Only) can be done via the below commands for cPanel Servers. It is a very similar process for Cyberpanel so skip to the bottom to see that process.

This is the all in one command set to do this for cPanel

class wpb_widget extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'wpb_widget',
// Widget name will appear in UI
__('WPBeginner Widget', 'wpb_widget_domain'),
  1. Make repo root / doc root directory mkdir my-project
  2. Enter the project dir cd my-project
  3. Install Grav composer create-project getgrav/grav . (Note: ignore errors about ext-zip missing)
  4. Intialize new lando (LAMP recipe) Interactive: lando init
  5. Alternately: use a one-liner: lando init --source cwd --recipe lamp --name my-project --webroot . --full
  6. Start Lando lando start
  7. Test the Lando and Grav installs (Go to supplied Lando URL. Should see "Please run: bin/grav install")
  8. Log into shell lando ssh
  9. Finish grav install bin/grav install
  10. In your browser, go to supplied Lando URL. Should see the Say Hello to Grav page.
function list_newsletters() {
$r = new WP_Query(
apply_filters(
'widget_newsletter_args',
array(
'post_type' => 'newsletter',
'posts_per_page' => 99,
'no_found_rows' => true,
'post_status' => array('finished'),
add_action('init', 'use_jquery_from_google');
function use_jquery_from_google () {
if (is_admin()) {
return;
}
global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
$ver = $wp_scripts->registered['jquery']->ver;
#!/bin/bash
## NOTE: uses aws s3 sync command which is how v2 of the CLI likes it.
## Set Date (for all backups)
NOW=$(date +"%Y-%m-%d")
## Construct S3API --query parameter (for all backups)
## Parameter limits Amazon S3 tagging of records to today's files
STRING_1="Contents[?LastModified>="