Skip to content

Instantly share code, notes, and snippets.

View shamimsdp's full-sized avatar
💦

Shamim Khan shamimsdp

💦
View GitHub Profile
@shamimsdp
shamimsdp / gist:376f9d60e3b64d29dc4ccc82099be14e
Created November 4, 2019 06:00 — forked from CodeTheInternet/gist:9312404
JSON with country data, including base64 encoded flag images
[{"id":1,"name":"Afghanistan","isoAlpha2":"AF","isoAlpha3":"AFG","isoNumeric":4,"currency":{"code":"AFN","name":"Afghani","symbol":"؋"},"flag":"iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAIAAAAVyRqTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo3REQwQzQwNjE3NTMxMUUyODY3Q0FBOTFCQzlGNjlDRiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3REQwQzQwNzE3NTMxMUUy
@shamimsdp
shamimsdp / functions.php
Created September 5, 2019 10:21 — forked from claudiosanches/functions.php
WooCommerce - Add Order Again button to My Orders actions
<?php
/**
* Add order again button in my orders actions.
*
* @param array $actions
* @param WC_Order $order
* @return array
*/
function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
if ( $order->has_status( 'completed' ) ) {
@shamimsdp
shamimsdp / all-quiz.js
Created September 5, 2019 09:25 — forked from igorbenic/all-quiz.js
Building a Quiz with React and WordPress REST API: Quiz Component | https://www.ibenic.com/quiz-wordpress-rest-api-react-scripts-tool
import React, { Component } from 'react';
import Question from './components/Question';
import './Quiz.css';
/* global wpqr */
class Quiz extends Component {
constructor() {
super();
this.state = { questions : [], answers: {}, currentQuestion: 0, lastQuestion: false, score: [] };
this.setNextQuestion = this.setNextQuestion.bind(this);
this.fetchQuestions = this.fetchQuestions.bind(this);
@shamimsdp
shamimsdp / answer.js
Created September 5, 2019 09:25 — forked from igorbenic/answer.js
Building a Quiz with React and WordPress REST API: Question and Answer Components | https://www.ibenic.com/quiz-react-wordpress-question-answer-components
import React, { Component } from 'react';
class Answer extends Component {
constructor(){
super();
// Binding handleChange to 'this'
this.handleChange = this.handleChange.bind(this);
}
handleChange(e) {
// Using the passed method setAnswer to set the answer.
@shamimsdp
shamimsdp / Login.js
Created September 5, 2019 09:10 — forked from igorbenic/Login.js
Headless WordPress: Logging with Google and JWT | https://www.ibenic.com/headless-wordpress-google-jwt
import React from 'react';
import { TextControl, Button, Notice } from '@wordpress/components';
import LoginGoogle from './login/LoginGoogle'; //Adding Google Component
const axios = require('axios');
class Login extends React.Component {
constructor( props ) {
super( props );
// ... previous bindings are here.
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
<?php // Don't copy me unless you need to!
/**
* Changes the coupon label output from Coupon: {code} to Coupon: {description}
*
* @param string $label the cart / checkout label
* @param \WC_Coupon $coupon coupon object
* @return string updated label
*/
function swwp_change_coupon_preview( $label, $coupon ) {