Skip to content

Instantly share code, notes, and snippets.

View Mamaduka's full-sized avatar

George Mamadashvili Mamaduka

View GitHub Profile
@ramiabraham
ramiabraham / wdscamp_noms.md
Last active October 9, 2015 02:19
[wdscamp 2015 wednesday dinner]

Chana Masala

Feeds 2 people

  • 1 (15 ounce) can chickpeas
  • 1 onion, chopped
  • 1 tomato, chopped
  • 1 green chili pepper, chopped
  • 4-5 garlic cloves, chopped
  • 1 inch ginger root, chopped
@PurpleBooth
PurpleBooth / README-Template.md
Last active December 3, 2025 00:19
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@rmccue
rmccue / gist:99df1e545bd8bf45c9b8
Last active August 29, 2015 14:22
Demo code from WC talk - Requires v2 of the REST API
<?php
/**
* Grab latest post title by an author!
*
* @param array $data Options for the function.
* @return string|null Post title for the latest,
 * or null if none.
*/
function my_awesome_func( $data ) {
$posts = get_posts( array(
@Lewiscowles1986
Lewiscowles1986 / lc-svg-upload.php
Last active August 4, 2016 13:45
SVG Media Plugin for WordPress (Works since 4.1.2!)
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@johnbillion
johnbillion / gist:4fa3c4228a8bb53cc71d
Last active February 18, 2025 13:06
WordPress Flow
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@JayWood
JayWood / distance_check.php
Last active August 29, 2015 14:16
Calculate the distance between two lat/long points in the world.
<?php
/**
* Calculate the distance between two points.
*/
class DistanceCheck {
/**
* Calculate
@bradp
bradp / gist:8b379e71daa4b6a61d14
Last active March 17, 2025 08:14
Useful SQL Queries
#Get the size of each table, ordered by largest to smallest
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "YOU+TABLE+NAME+HERE"
ORDER BY (data_length + index_length) DESC;
#Get the size of the entire DB
SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
@imath
imath / bp-custom.php
Created January 29, 2015 19:06
Code Snippet to put in your bp-custom.php file to be able to filter the BuddyPress members directory by member types (requires BuddyPress version 2.2-beta1)
<?php
/**
* Using BuddyPress Member types API
*
* see codex: https://codex.buddypress.org/developer/member-types/
*
* Required config:
* - WordPress 4.1
* - BuddyPress 2.2
*
<?php
/**
* Plugin Name: (WCM) Backbone/Underscore template loader
* Description: Loads Underscore (or other) templates using the WP Dependency API
*/
/**
* @author Franz Josef Kaiser http://unserkaiser.com/
* @link http://chat.stackexchange.com/transcript/message/19439060#19439060
*/
@ericandrewlewis
ericandrewlewis / gist:a1b127aefbd58c210666
Last active January 19, 2019 00:02
Towards a data model for scalable queries against rich WordPress post attribute data

Towards a data model for scalable queries against rich WordPress post attribute data

This document is in draft status, and is being made available for peer review. If you have feedback, comment on this gist or email me.

Let's say you're a web developer. A client of yours is a gemstone dealer in Manhattan. This dealer has an inventory of gemstones that they'd like to put on their website.

Gemstones have a plethora of attributes: type of gemstone (e.g. sapphire or emerald), price, weight, width, height, depth, color, shape, country of origin, treatment (if it's heat treated), who certified these details, whether the stone is a single stone or a pair.

You're offered the task to make a website to display the gemstone inventory, which will include a search interface. So a user can say "I want to see sapphires that are no heavier than 1.33 karats that are oval, between $750 and $1250, between 1.11mm and 1.20mm that weren't heat treated, because heat treatment is cheap."