Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View iamgabrielma's full-sized avatar

Gabriel Maldonado iamgabrielma

View GitHub Profile
@iamgabrielma
iamgabrielma / wpcom_dmca.php
Created February 3, 2019 11:26
DMCA-WP to disable specific page/content
/*
Plugin Name: DMCA content removal
Description: For DMCA content removal requests
Author: aaron-p9F6qB-2oq-p2
*/
function wpcom_dmca() {
if ( is_single( 1057 ) ) {
global $wp_query;
$wp_query->set_404();
@iamgabrielma
iamgabrielma / functions.php
Created January 20, 2019 04:56
Allow .kml file upload 1721841-zen
// Add as many keys/values to the $mimes Array as needed
function gma_zen_1721841_custom_upload_mimes($mimes = array()) {
$mimes['kml'] = "application/xml";
return $mimes;
}
add_action('upload_mimes', 'gma_zen_1721841_custom_upload_mimes');
@iamgabrielma
iamgabrielma / index.js
Created December 21, 2018 11:42
Example of using the WP REST API outside of WordPress.com. Demo (1): JS & XMLHttpRequest
const apiRoot = 'https://public-api.wordpress.com/',
articleContainer = document.querySelector('main#main'),
listPosts = {};
/**
* init - Initialize the listing of posts
*
*/
listPosts.init = function() {
@iamgabrielma
iamgabrielma / functions.php
Created September 27, 2018 07:47
WP Job Manager - Remove all company details from the job submission page
add_filter( 'submit_job_form_fields', 'gma_custom_submit_job_form_fields' );
function gma_custom_submit_job_form_fields( $fields ) {
unset($fields['company']['company_name']);
unset($fields['company']['company_website']);
unset($fields['company']['company_tagline']);
unset($fields['company']['company_video']);
unset($fields['company']['company_twitter']);
unset($fields['company']['company_logo']);
@iamgabrielma
iamgabrielma / functions.php
Last active April 26, 2019 08:12
WP Job Manager - Remove “Listing Expires” column from Job Dashboard
/* This snippet removes the “Listing Expires” column from Job Dashboard */
add_filter( 'job_manager_job_dashboard_columns', 'remove_expires_column' );
function remove_expires_column( $columns ) {
unset( $columns['expires'] );
return $columns;
}
/* This snippet removes the “Listing Expires” column from All Jobs in wp-admin */
add_filter( 'manage_edit-job_listing_columns', 'remove_expires_column_admin' );
function remove_expires_column_admin( $columns ) {
@iamgabrielma
iamgabrielma / functions.php
Created August 21, 2018 11:24
Stop Jetpack Publicize from sharing new WP Job Manager job listings submitted via the front-end
/**
* Stop Jetpack Publicize sharing posts from the frontend job submit form entries
*
* @param $new_status
* @param $old_status
* @param $post
*/
function prefix_flag_post_for_publicize( $new_status, $old_status, $post ) {
// Make sure the job_manager_form is set, it is the job_listing post type and the post status is publish
@iamgabrielma
iamgabrielma / pandahellprocgen.cs
Created July 8, 2018 06:32
Example of procedural level generator using the Random Walker Algorithm
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProceduralLevelGenerator : MonoBehaviour
{
enum gridSpace { empty, floor, wall };
gridSpace[,] grid; // 2D array of grid spaces that holds information about our map
int roomHeight, roomWidth;
//Vector2 roomSizeWorldUnits = new Vector2(30, 30);