Skip to content

Instantly share code, notes, and snippets.

View valmayaki's full-sized avatar
🤠
Happy to be of service to you!

Valentine Ubani Mayaki valmayaki

🤠
Happy to be of service to you!
View GitHub Profile
@ahmadawais
ahmadawais / upload-a-file.MD
Created June 18, 2017 11:07 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@vinicius73
vinicius73 / chart.vue
Last active June 3, 2024 16:48
Vue.js + C3.js
<script>
import c3 from 'c3'
import { debounce, cloneDeep, defaultsDeep } from 'lodash'
export default {
name: 'c3-chart',
props: {
config: {
type: Object,
default: () => ({})
@vuejsdevelopers
vuejsdevelopers / script.js
Created May 25, 2017 14:20
Using JSX with Vue.js - Snippet 08
{
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: 'babel-loader',
options: { presets: ['es2015'], plugins: ['transform-vue-jsx'] }
}]
}
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 26, 2026 20:34
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@tnog
tnog / customer_registration_email_alert.php
Created March 30, 2017 05:08
WooCommerce: Send a custom admin email when a new customer creates a new account.
<?php
namespace Your\Custom\Namespace;
/**
* Send a custom admin email when a new customer creates a new account.
* @param integer $user_id The ID of the user whose data should be retrieved.
* @return [type] [description]
*/
function customer_registration_email_alert( $user_id ) {
@imath
imath / tickets.php
Last active January 20, 2026 00:23
Using WP Statuses for custom Post Types.
<?php
/**
* Using WP Statuses for custom Post Types.
*
* @link http://github.com/imath/wp-statuses
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@ariefhikam
ariefhikam / index.php
Last active August 6, 2019 12:25
Laravel Sorting from another table with Eloquent
/*
By: Arief Hikam
Laravel Sorting from another table with Eloquent
Sometimes it is difficult to perform sorting by Eloquent because relationships do not use the JOIN in query builder but use
Eager Load which mean we can not sorting by another table field because the field is doesn't exist.
This is how we use the simple code Eloquent and sorting another table by using LEFT JOIN.
I think this is the simplest way I can think of.
@mkornatz
mkornatz / buddy-craft-atomic-deploy.php
Last active December 4, 2017 19:22
A simple script for atomic deployments within Buddy CI.
<?php
/*
*/
process(is_array($argv) ? $argv : array());
/**
* processes the installer
*/
@miya0001
miya0001 / cors-for-the-wordpress-rest-api.php
Last active January 29, 2025 02:47
CORS for the WordPress REST API
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );
anonymous
anonymous / docke-compose.yml
Created January 6, 2017 18:32
version: '2'
services:
database:
image: mysql:5.6
volumes:
- dbdata:/var/lib/mysql
environment:
- "MYSQL_DATABASE=homestead"
- "MYSQL_USER=homestead"