Skip to content

Instantly share code, notes, and snippets.

View jondcampbell's full-sized avatar

Jon Campbell jondcampbell

View GitHub Profile
@karanlyons
karanlyons / ZoomDaemon.yara
Last active July 12, 2021 14:07
Fixes for Zoom, RingCentral, Zhumu (and additional white labels) RCE vulnerabilities
private rule Macho
{
meta:
description = "private rule to match Mach-O binaries (copied from Apple's XProtect)"
condition:
uint32(0) == 0xfeedface or uint32(0) == 0xcefaedfe or uint32(0) == 0xfeedfacf or uint32(0) == 0xcffaedfe or uint32(0) == 0xcafebabe or uint32(0) == 0xbebafeca
}
rule ZoomDaemon
{
@avillegasn
avillegasn / gutenberg.js
Last active October 9, 2019 07:36
Fragments of code to add a custom button to Gutenberg rich text blocks
import ElementIcon from '../images/logo.svg';
const { Fragment } = wp.element;
const { __ } = window.wp.i18n;
const { registerFormatType, unregisterFormatType } = window.wp.richText;
const { RichTextToolbarButton } = window.wp.blockEditor;
unregisterFormatType( 'nelio/button' );
registerFormatType( 'nelio/button', {

Familiar Tools

A way for me to remember what my go-to libraries and utilities are.

PHP

Working with APIs

  • HTTP Requests - Guzzle
  • Logging - Monolog

JavaScript

VueJS

@jtsternberg
jtsternberg / recursive-array-calculate.php
Last active December 28, 2017 23:48
Recursively calculate totals from an array of arrays (with matching keys, etc)
<?php
/**
* Calculate totals from a nested array. Handles nested recursion.
* Uses first nested array as the "pattern" for building the totals array.
*
* @param array $to_count The multi-dimensional array to calculate the totals for.
*
* @return array The array of totals.
*/
function calculate_array_totals( $to_count ) {
@spivurno
spivurno / gp-preview-submission-display-filename.php
Created March 14, 2017 13:36
Gravity Perks // GP Preview Submission // Display Filename for File Upload Fields
<?php
/**
* Gravity Perks // GP Preview Submission // Display Filename for File Upload Fields
* http://gravitywiz.com/documentation/gravity-forms-preview-submission/
*/
add_filter( 'gpps_special_merge_tags_value_fileupload', function( $value, $field, $input_id, $modifier, $form, $entry ) {
if( ! $field->multipleFiles ) {
$input_name = 'input_' . str_replace( '.', '_', $field->id );
$file_info = GFFormsModel::get_temp_filename( $form['id'], $input_name );
@wesbos
wesbos / gist:0d5572a29e4f5688a1c8
Last active September 1, 2023 17:59
Handy list of widths to target in a responsive website
320
321
322
323
324
325
326
327
328
329
@spivurno
spivurno / gw-gravity-forms-populate-field-value-into-subsequent-field.php
Created November 16, 2015 02:46
Gravity Wiz // Gravity Forms // Populate Field Value from One Page to Field in Subsequent Page
/**
* Gravity Wiz // Gravity Forms // Populate Field from One Page to Field in Subsequent Page
* http://gravitywiz.com/
*/
// update "1074" to the ID of your form
add_filter( 'gform_pre_render_1074', function( $form ) {
foreach( $form['fields'] as &$field ) {
// update "2" to the field ID on the later page
// Change the column widths to match your site
@media #{$large-up} {
.content-sidebar .content-sidebar-wrap {
main {
@include grid-column(9);
}
aside.sidebar-primary {
@include grid-column(3);
}
@thoronas
thoronas / gist:2876f159404b7547d89b
Last active August 29, 2015 14:24
Function for uploading images from URL to WordPress. Thanks to Andrew Norcross for help with this.
<?php
function upload_external_image( $post_id, $img_url ) {
// load media handlers
require_once( ABSPATH . 'wp-admin' . '/includes/image.php' );
require_once( ABSPATH . 'wp-admin' . '/includes/file.php' );
require_once( ABSPATH . 'wp-admin' . '/includes/media.php' );
// create a temp file
$temp_file = download_url( $img_url );
@aaroneaton
aaroneaton / Navigation.php
Last active March 7, 2017 19:10
Using the Zurb Foundation Top Bar with WordPress menus
<?php
class Navigation {
public function __construct() {
// Move the navigation to the header element
remove_action( 'genesis_after_header', 'genesis_do_nav' );
remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
// remove_action( 'genesis_header', )