A way for me to remember what my go-to libraries and utilities are.
- HTTP Requests - Guzzle
- Logging - Monolog
| 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 | |
| { |
| 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', { |
| <?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 ) { |
| <?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 ); |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 |
| /** | |
| * 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); | |
| } |
| <?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 ); |