Skip to content

Instantly share code, notes, and snippets.

View mattmcgiv's full-sized avatar
😎

Matt McGivney mattmcgiv

😎
View GitHub Profile
@mattmcgiv
mattmcgiv / dashicons.php
Created March 27, 2016 17:47
Add WP Dashicons to front-end
<?php
add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );
/**
* Enqueue Dashicons style for frontend use when enqueuing your theme's style sheet
*/
function mytheme_scripts() {
wp_enqueue_style( 'mytheme-style', get_stylesheet_uri(), 'dashicons' );
}
font-family: -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
@mattmcgiv
mattmcgiv / get_total_num_WC_orders.php
Created April 12, 2016 14:09
Get the total number of WooCommerce orders from WordPress
//gets the total number of WooCommerce orders from the WP database
function get_number_of_orders() {
global $wpdb;
//get number of orders from database as array
$number_of_orders_array_n = $wpdb->get_results(
"SELECT COUNT(*) FROM wp_posts WHERE post_type = 'shop_order'", ARRAY_N);
//convert number of orders array into a number
@mattmcgiv
mattmcgiv / add-role-to-users.php
Last active January 11, 2017 16:04
Add a role to all users
<?php
//Uncomment the following line for converting one role to another
//add_action( 'the_post', 'convert_subscribers_to_executives' );
function convert_subscribers_to_executives() {
//Note: this only works by navigating to the page with ID 5883 on the site
//to kick off the loop that updates all of the users.
if (get_the_ID() === 5883) {
//get all subscribers from this WP site
$blogusers = get_users( 'blog_id=1&orderby=nicename&role=subscriber' );
@mattmcgiv
mattmcgiv / add-autocomplete-to-gravity-forms.php
Created January 11, 2017 18:56
add-autocomplete-to-gravity-forms
<?php
add_filter( 'gform_field_content', function ( $field_content, $field ) {
if ( $field->type == 'email' ) {
return str_replace( 'type=', "autocomplete='email' type=", $field_content );
}
if ( $field->type == 'name' ) {
return str_replace( 'type=', "autocomplete='name' type=", $field_content );
}
return $field_content;
@mattmcgiv
mattmcgiv / blockcypher_example_response.json
Last active September 2, 2017 16:15
blockcypher_example_response.json
[
{
"name": "/tmp/geth-compile-solidity400040342:Owned",
"solidity": "pragma solidity ^0.4.8;\n\ncontract Owned {\n address public owner;\n\n function Owned() {\n owner = msg.sender;\n }\n\n modifier onlyOwner {\n require(msg.sender == owner);\n _;\n }\n\n function transferOwnership(address newOwner) onlyOwner {\n owner = newOwner;\n }\n}\n\ncontract TokenRecipient {\n function receiveApproval (address _from, uint256 _value, address _token, bytes _extraData);\n}\n\ncontract ScrypTestflight is Owned {\n /* Public variables of the token */\n string public standard = \"Test Scryp 0.1\";\n string public name;\n string public symbol;\n uint8 public decimals;\n uint256 public totalSupply;\n\n /* This creates an array with all balances */\n mapping (address =\u003e uint256) public balanceOf;\n mapping (address =\u003e mapping (address =\u003e uint256)) public allowance;\n\n /* This generates a public event on the blockchain t
@mattmcgiv
mattmcgiv / 00
Created September 7, 2017 21:48
public ethereum address (private-net)
0x1418c2A5B8A2F547f2417996D39fB351777F2492
@mattmcgiv
mattmcgiv / 01
Created September 13, 2017 15:21
0xfb70456839B62ca7bA09a1fA9E5a553E5e36D4c4
@mattmcgiv
mattmcgiv / 02
Created September 13, 2017 16:35
0x22b07cfd25cf068a444364e8531be5fac8af7ef1
#!/bin/bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
nvm install 8.2.1 # node newer version install
npm install -g npm