Skip to content

Instantly share code, notes, and snippets.

View iamgabrielma's full-sized avatar

Gabriel Maldonado iamgabrielma

View GitHub Profile
@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 / 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 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 / 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();
/* Atomic V1 & V2 */
if( ( defined( 'PRESSABLE_PROXY' ) && PRESSABLE_PROXY ) || ( defined( 'ATOMIC_PROXY' ) && ATOMIC_PROXY ) ) {
// Your code here
}
@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 / AdManager.cs
Created May 26, 2019 05:21
Ad Manager that deals with Unity Ads between gameplays
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
namespace Ngu
{
public class AdManager : MonoBehaviour
{
@iamgabrielma
iamgabrielma / MapColorPulse.cs
Created May 29, 2019 01:17
Modifies the alpha value of a GameObject following a pulse rhythm, creating the effect of appear/disappear gradually.
IEnumerator MapColorPulse()
{
bool isLimitReached = false;
map = GameObject.Find("Map");
SpriteRenderer mapRendererComponent = map.GetComponent<SpriteRenderer>();
initialMapAlphaValue = mapRendererComponent.color.a; // 1
//Debug.Log("Initial alpha: " + initialMapAlphaValue); // 1
// Test: Using Find() + new Color for setting up the alpha value:
@iamgabrielma
iamgabrielma / FloatingTextController.cs
Created May 30, 2019 11:59
Creates floating text on events
/* FloatingTextController.cs*/
public class FloatingTextController : MonoBehaviour
{
private static FloatingText popupText;
private static GameObject canvas;
public static void Initialize()
## in PlayerCollisions.cs , attached to the player game object:
public bool isPlayerTakingDamage;
public void Start(){
isPlayerTakingDamage = false;
}