Skip to content

Instantly share code, notes, and snippets.

View userabuser's full-sized avatar
💭
What's good?

userabuser

💭
What's good?
View GitHub Profile
@Rarst
Rarst / deprecated.md
Last active February 21, 2023 11:21
WordPress coding standards configuration for PhpStorm

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)

@reinink
reinink / gist:1392767
Created November 25, 2011 03:42
PHP wrapper for Google Weather API
<?php
class Google_Weather
{
public $condition;
public $temperature;
public $humidity;
public $icon;
public $wind_direction;
public $wind_speed;
@Rarst
Rarst / r-debug.php
Last active June 12, 2025 01:56
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@luetkemj
luetkemj / wp-query-ref.php
Last active April 8, 2026 18:20
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@da1nonly
da1nonly / gist:2057532
Created March 17, 2012 10:55
wordpress meta box urls
<?php
add_action('admin_init', 'add_meta_boxes', 1);
function add_meta_boxes() {
add_meta_box( 'repeatable-fields', 'Audio Playlist', 'repeatable_meta_box_display', 'post', 'normal', 'high');
}
function repeatable_meta_box_display() {
global $post;
@mustmodify
mustmodify / cancan.php
Created March 30, 2012 20:02
How to implement URP in PHP using a cancan-style interface
<?php
class User
{
public $admin;
public $roles = array();
function roles()
{
if (isset($this))
@michaellehmkuhl
michaellehmkuhl / gist:2345870
Created April 9, 2012 19:26
PHP timezone conversion functions
/**
* Get the offset of the given timezone (in seconds)
*/
function getTimeZoneOffset($timezone='') {
$tz_tmp = new DateTimeZone($timezone);
$dt_tmp = new DateTime('now', $tz_tmp);
$offset = $dt_tmp->getOffset();
return $offset;
}
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@jeremyclark13
jeremyclark13 / gist:2470972
Created April 23, 2012 13:36
New function wp_get_theme for WordPress 3.4
<?php
$theme_data;
if (function_exists('wp_get_theme')){
$theme_data = wp_get_theme('theme-name');
$theme_uri = $theme_data->ThemeURI;
$author_uri = $theme_data->Author_URI;
} else {
$theme_data = (object) get_theme_data(get_template_directory() . '/style.css');
$theme_uri = $theme_data->URI;
$author_uri = $theme_data->AuthorURI;
@jeremyclark13
jeremyclark13 / gist:2471214
Created April 23, 2012 14:21
WordPress simple twitter feed function
<?php
/**
* Simple WordPress Twitter feed
*
*
* @param string $user user of twitter feed to retrieve.
* @param string $count number of tweets to retrive.
*
* Inspiration for code:
* Chip Bennet's oenology theme https://github.com/chipbennett/oenology