Skip to content

Instantly share code, notes, and snippets.

View mcfarhat's full-sized avatar

Mohammad Farhat mcfarhat

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mcfarhat on github.
  • I am mcfarhat (https://keybase.io/mcfarhat) on keybase.
  • I have a public key ASBYmYXKofMbPx1gNmyWDM8MSTeUw36P4ZJEI4PeBupf-Ao

To claim this, I am signing this object:

@mcfarhat
mcfarhat / create_and_claim_hf20.html
Last active April 25, 2021 08:32
Script which enables using the new HF20 claim and create discounted accounts operations available to any user with enough RCs
<html>
<head>
<script src="https://unpkg.com/dsteem@0.10.0/dist/dsteem.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
//hook for action button
$('#create_claim').click(function(){
claimCreate();
<html>
<head>
<!-- including steemjs library for performing calls -->
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>
<script>
create_steemit_user();
function create_steemit_user(){
//set the proper steemit node to be used, otherwise default steem-js node will fail
steem.api.setOptions({ url: 'https://api.steemit.com' });
/* Creating the car custom post type */
if ( ! function_exists('gk_create_car_type') ) {
// Register Car Custom Post Type
function gk_create_car_type() {
$labels = array(
'name' => _x( 'Cars', 'Post Type General Name', 'car' ),
'singular_name' => _x( 'Car', 'Post Type Singular Name', 'car' ),
'menu_name' => __( 'Cars', 'car' ),
<?php
//hooks required to perform the connection between AJAX calls and php function
add_action( 'wp_ajax_nopriv_filter_matching_cpts', 'filter_matching_cpts' );
add_action( 'wp_ajax_filter_matching_cpts', 'filter_matching_cpts' );
/* function handling the generation and response back to the AJAX call/front end
function filter_matching_cpts(){
//perform a query to grab the instances of the custom post type
$args = array(
'post_type' => 'cpt',
<?php
/* overriding og:title format for bank entry post types */
function gk_bank_entry_wpseo_og_title( $title ) {
//only perform this action on single posts
if ( is_singular() ) {
//grab currently available post
$post = get_queried_object();
//check for match of the intended post type
if (get_post_type($post) == 'bank_entry'){
//append the post type to the title
@mcfarhat
mcfarhat / mealoptions.php
Created October 5, 2016 20:38
meal options sample code
<?php $item_options = array('Meal1','Meal2','Meal3','Meal4','Meal5','Meal6');
//exit if no user is logged in
if (!is_user_logged_in())
return;
//to display message if a save event took place
$updated = false;
//if this is a save event
if (isset($_GET['item']) && !empty($_GET['item'])){
$item_to_update = $_GET['item'];