Skip to content

Instantly share code, notes, and snippets.

View mircobabini's full-sized avatar

Mirco Babini mircobabini

View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@Gautier
Gautier / CountDownTimer.java
Created December 12, 2010 00:58
Drop-in alternative for the Android CountDownTimer class, but which you can cancel from within onTick.
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@caseyohara
caseyohara / reserved_usernames.rb
Created December 9, 2011 22:58
A list of reserved usernames to avoid vanity URL collision with resource paths
# A list of possible usernames to reserve to avoid
# vanity URL collision with resource paths
# It is a merged list of the recommendations from this Quora discussion:
# http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features
# Country TLDs found here:
# http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
# Languages found here:
@jasperf
jasperf / lookforbadguys.php
Created July 28, 2012 00:47
Look for Bad Guys By Karen Chun, Steven Whitney #security #php
<?php
/* lookforbadguys.php 2011-09-27
Copyright (C)2011 Karen Chun, Steven Whitney.
Initially published by http://25yearsofprogramming.com.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@clawfire
clawfire / functions.php
Created August 7, 2012 13:18
Don't display placeholder and image if there's no picture defined for a category
<?php
// unload the original one
remove_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail');
// load mine
add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail_custom', 10);
if ( ! function_exists( 'woocommerce_subcategory_thumbnail_custom' ) ) {
function woocommerce_subcategory_thumbnail_custom( $category ) {
global $woocommerce;
@wokamoto
wokamoto / user_meta_transient.php
Last active July 17, 2023 11:53
[WordPress] user_meta transient
<?php
/**
* Delete a user meta transient.
*/
function delete_user_meta_transient( $user_id, $transient ) {
global $_wp_using_ext_object_cache;
$user_id = (int) $user_id;
do_action( 'delete_user_meta_transient_' . $transient, $user_id, $transient );
@strangerstudios
strangerstudios / pmpro_cancel_on_next_payments_date.php
Last active July 5, 2024 05:12
Change PMPro membership cancellation to set expiration date for next payment instead of cancelling immediately.
/*
Change cancellation to set expiration date for next payment instead of cancelling immediately.
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.)
function my_pmpro_before_change_membership_level($level_id, $user_id) {
//are we on the cancel page?
@Swaagie
Swaagie / visibly.js
Last active December 21, 2015 00:39 — forked from addyosmani/visibly.js
Updated visibly against firefox native API
/*!
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill
* Copyright (c) 2011 Addy Osmani
* Dual licensed under the MIT and GPL licenses.
*/
(function () {
window.visibly = {
b: null,
q: document,
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active July 19, 2024 07:35
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@renestalder
renestalder / README.md
Last active June 30, 2024 14:55
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.