Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond. I am also slow as a person.

Salvatore Capolupo salvatorecapolupo

💭
I may be slow to respond. I am also slow as a person.
Block or report user

Report or block salvatorecapolupo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@salvatorecapolupo
salvatorecapolupo / noduplicates.sql
Last active Apr 22, 2019
WordPress find post duplicates via MySQL query - Used to remove duplicated posts from WordPress - i.e https://www.lipercubo.it, https://capolooper.it
View noduplicates.sql
SELECT a.ID, a.post_title, a.post_type, a.post_status
FROM wp_posts AS a
INNER JOIN (
SELECT post_title, MIN( id ) AS min_id
FROM wp_posts
WHERE post_type = 'post'
AND post_status = 'publish'
GROUP BY post_title
HAVING COUNT( * ) > 1
) AS b ON b.post_title = a.post_title
@HechtMediaArts
HechtMediaArts / .htaccess
Last active Mar 26, 2020
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
View .htaccess
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2020
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@anttiviljami
anttiviljami / wp-admin-modal-dialog.php
Last active Feb 2, 2020
WordPress admin modal dialog example
View wp-admin-modal-dialog.php
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@dekdevy
dekdevy / jstiles.js
Last active Oct 14, 2016
Simple 2D Tilemap and Recording Framework
View jstiles.js
var map;
var canvas;
var dimensions;
var mapSize;
var unitsize;
var frames = new Array();
function init(basecolor, tileamount, boardsize) {
// init
canvas = document.getElementById("canvas");
@scottopolis
scottopolis / wp-api-user-meta.php
Last active Aug 18, 2019
Add user meta to the WP-API
View wp-api-user-meta.php
<?php
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */
function sb_user_meta( $data, $field_name, $request ) {
if( $data['id'] ){
$user_meta = get_user_meta( $data['id'] );
}
if ( !$user_meta ) {
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) );
}
@gokulkrishh
gokulkrishh / media-query.css
Last active Mar 30, 2020
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@trevex
trevex / scraper.js
Created Aug 25, 2015
simple web scraper to download the audio from gamemusic.siroro.co.uk/
View scraper.js
var request = require("request"),
cheerio = require("cheerio"),
root = "http://gamemusic.siroro.co.uk/";
function process(url, dir) {
request(url, function(error, response, body) {
if (!error) {
var $ = cheerio.load(body),
filenames = $("span.file-name"),
alert = $("div.alert")[0];
@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active Mar 11, 2020
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
View ALTERNATIVES.adoc
@salvatorecapolupo
salvatorecapolupo / Coffescript -> JS conversion
Last active Jun 29, 2016
coffeescript basic: how to install and basic massive compiling
View Coffescript -> JS conversion
# Using Mac you will need importing cooffe-script library:
sudo npm install -g coffee-script
# now you can convert cooffee-scripts ("compressed" version of a normal javascript file) into more familiar JS, i.e
coffee -c --output gamejs/ game/
#which converts all file into game/ in a new directory called gamejs/.
@danielpataki
danielpataki / ajax-action.php
Last active Mar 15, 2018
Ajax in WordPress
View ajax-action.php
add_action( 'wp_ajax_button_click', 'user_clicked' );
function user_clicked() {
update_user_meta( get_current_user_id(), 'clicked_link', 'yes' );
wp_redirect( $_SERVER['HTTP_REFERER'] );
exit();
}
You can’t perform that action at this time.