Skip to content

Instantly share code, notes, and snippets.

@brandonkramer
brandonkramer / bulk-edit-yoast-canonical-url.php
Created October 24, 2020 00:16
Change Yoast canonical URL in bulk for all posts for consolidation/migration by updating the meta field
add_action( 'wp_head', function () {
if ( isset( $_GET[ 'bulk-edit-canonical-url' ] ) ) {
$args = [
'post_type' => 'post',
'suppress_filters' => true,
'posts_per_page' => -1,
'post_status' => [ 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit' ],
];
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
@123tris
123tris / $CooldownManagerExample.cs
Last active January 22, 2024 00:45
A unity script for easily delaying parts of your code
//----------- Example code -----------
float health = 5;
CooldownManager.Cooldown(2, () => health++); //Delay health increment by 2 seconds
CooldownManager.Cooldown(5, Shoot); //Invoke shoot in 5 seconds
void Shoot () { }
//If you dont want to use lambda's for functions with parameters you can overload the function like so:
CooldownManager.Cooldown(2, Damage, 5); //Calls Damage() function with damageValue 5 after 2 seconds have passed
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@naxmefy
naxmefy / English.js
Last active January 2, 2022 21:03
Unity3D Internationalization (I18N)
#pragma strict
public class English {
public static var lang : Hashtable = {
// General
"game_name": "My Awesome Game"
// Menus
, "new_game" : "New Game"
, "save_game" : "Save Game"
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {
@jonathanbell
jonathanbell / Instarss.md
Last active March 18, 2023 00:03
August 28 2014 - InstaRss

Instarss

I was looking around for a way to get a user's public Instagram feed as an RSS feed without using the Instagram API when I came across this question on Stack Overflow.

Probably the best way to do this, would be to use the Instagram API. However, I had no desire to sign up for an Instagram account.

Initially, this answer on Stack Overflow suited my needs quite well. However, as fate would have it, Instagram changed its HTML output and the page's JSON data structure changed. Since the idea is quite simple (we're just screen scrapping here) I decided to write my own script. If this works well for you, consider upvoting my answer on Stack Overflow: http://stackoverflow.com/a/25559442/1171790