Skip to content

Instantly share code, notes, and snippets.

View joecue's full-sized avatar
🎯
Focusing

Joe Querin joecue

🎯
Focusing
View GitHub Profile
@jakebellacera
jakebellacera / ICS.php
Last active July 10, 2024 11:27
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@JustinSainton
JustinSainton / url-spamcheck.php
Last active February 4, 2016 13:02 — forked from norcross/url-spamcheck.php
Marks any comment as spam whose author link is greater than 50 chars.
<?php
function rkv_url_spamcheck( $approved , $commentdata ) {
return ( strlen( $commentdata['comment_author_url'] ) > 50 ) ? 'spam' : $approved;
}
add_filter( 'pre_comment_approved', 'rkv_url_spamcheck', 99, 2 );
@gmazzap
gmazzap / CptInMainQueryByMeta.php
Created January 10, 2014 14:42
Simlpe plugin coded to refactor the code posted on a WPSE anwser
<?php
/**
* Plugin Name: Cpt In Main Query By Meta
* Plugin URI: http://wordpress.stackexchange.com/questions/129236/
* Description: Allow mixing a post type with another on main query, only if the second match some meta query args
* Author: Giuseppe Mazzapica
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*/
@joelworsham
joelworsham / wp-gruntfile-4.2.0.js
Last active August 29, 2015 14:21
The WordPress Gruntfile
/* jshint node:true */
module.exports = function(grunt) {
var path = require('path'),
SOURCE_DIR = 'src/',
BUILD_DIR = 'build/',
mediaConfig = {},
mediaBuilds = ['audiovideo', 'grid', 'models', 'views'];
// Load tasks.
require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
WORDPRESS 201 OUTLINE
TEMPLATE HIERARCHY
• https://developer.wordpress.org/themes/basics/template-hierarchy/
THE LOOP
• https://codex.wordpress.org/The_Loop
• Resetting the Loop
• Multiple Loops on one page
HOOKS, ACTIONS, FILTERS
var project = 'slilccc', // Project name, used for build zip.
scssfolder = './wp-content/themes/' + project + '/SCSS',
workingdir = './wp-content/themes/' + project + '/',
cssdir = './wp-content/themes/' + project + '/css/',
buildir = './wp-content/themes/' + project + '_build/',
url = 'lccc.dev', // Local Development URL for BrowserSync. Change as-needed.
gulp = require('gulp'),
browserSync = require('browser-sync'), // Asynchronous browser loading on .scss file changes
reload = browserSync.reload,
autoprefixer = require('gulp-autoprefixer'), // Autoprefixing magic
@carrieforde
carrieforde / brackets-extensions.md
Last active May 10, 2017 19:10
A list of Brackets Extensions I Love
@sohelrana820
sohelrana820 / create_and_download_zip.php
Last active May 7, 2023 19:53
Create and download ZIP file in PHP
<?php
/**
* @author: Sohel Rana <me.sohelrana@gmail.com>
* @author URI: http://sohelrana.me
* @description: Create zip file and download in PHP
*/
function createZipAndDownload($files, $filesPath, $zipFileName)
{
// Create instance of ZipArchive. and open the zip folder.
@holmberd
holmberd / php-pools.md
Last active June 28, 2024 14:43
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@kierzniak
kierzniak / functions.php
Created January 17, 2018 21:55
Search across all network blogs in elasticpress
<?php
/**
* Search across all network blogs with elasticpress
*
* @param $scope string Search scope
*
* @return string
*/
function motivast_ep_search_scope( $scope ) {