Skip to content

Instantly share code, notes, and snippets.

@helen
helen / repeatable-fields-metabox.php
Created January 11, 2012 04:42
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@rolandinsh
rolandinsh / gist:5143047
Last active September 8, 2022 15:19
Codeigniter file upload permissions (CHMOD)
<?php
$config['upload_path'] = './uploads/'; // upload path
/* OR any other form, e.g.:
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/uploads/'; // upload path
$config['upload_path'] = __DIR__.'/uploads/'; // upload path
*/
$config['allowed_types'] = 'zip'; // array or string of file extensions
$config['max_size'] = '100'; // max file size
$this->load->library('upload', $config); // do the job
$zdata = ['upload_data' => $this->upload->data()]; // get data
@janikvonrotz
janikvonrotz / footer.blade.php
Last active July 4, 2017 06:13
Laravel default templates #Laravel
@mcaskill
mcaskill / Function.Array-Group-By.php
Last active January 3, 2024 10:15
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.
@rezzz-dev
rezzz-dev / CLI.sh
Created January 7, 2016 14:58
PHP Code Sniffer with WordPress Coding Standards and Atom
#Install PHP CodeSniffer
brew install homebrew/php/php-code-sniffer #if using Homebrew
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs #if you want to do it directly
#Install WordPress Coding Standards
git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
#Add WordPress standards to PHPCS config
phpcs -i #shows the libraries installed
phpcs --config-set installed_paths <path to dir that you cloned>/wpcs
@mikejolley
mikejolley / gist:e73f9d061aaebd25ccdc
Created February 22, 2016 13:07
WooCommerce - Remove subtotal row.
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals ) {
unset($totals['cart_subtotal'] );
return $totals;
}
@glueckpress
glueckpress / GitHub-Desktop-Bitbucket.md
Last active June 3, 2024 13:31
[How-to] Use GitHub Desktop to clone and commit to a Bitbucket repository just as you would with any GitHub repository. (Mac)

⚠️ Note: this guide is from 2016 – a long time on the internet. Content may be outdated, check the comments for more recent info.


Clone Bitbucket Repository and Add it to GitHub Desktop App (Mac)

You can’t clone a Bitbucket repo using GithHub Desktop directly. Instead you would have to:

  1. Clone the Bitbucket repo locally via command line.
  2. Add the cloned repository to your GitHub Desktop app.
@a7madev
a7madev / Laravel-All.md
Last active July 3, 2017 06:03
Laravel

Laravel All

Make Migration

php artisan make:migration create_teacher_subjects_table
<?php
// Use anytime HTML element encloses a section of data:
echo esc_html( $no_html );
// Use on all URLs, including those in the 'src' and 'href' attributes of an HTML element:
<img src="<?php echo esc_url( $escaped_url ); ?>" />
// Use for inline Javascript:
<a href="#" onclick="<?php echo esc_js( $escaped_js ); ?>"><?php esc_html__( 'Click Here', 'text-domain' ); ?></a>