Skip to content

Instantly share code, notes, and snippets.

View purplefeel's full-sized avatar
💜
Green but Feeling purple

purple purplefeel

💜
Green but Feeling purple
View GitHub Profile
@purplefeel
purplefeel / gist:fc2c942605bb3aa41e6e449ca2104241
Created March 5, 2021 06:14 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@purplefeel
purplefeel / wp-author-import-auto-select.js
Last active May 5, 2021 17:10 — forked from webercoder/wp-author-import-auto-select.js
Auto-select authors for posts during WordPress import. They must already be assigned to the project. Enable jQuery in a plugin or functions.php, and paste this in the browser console.
(function($){
$('#authors li').each(function(key, value) {
var name = $(this).children('strong').first().html();
var re = /\s\([^\)]+\)/gi;
name = name.replace(re, '');
$(this).find('select').first().children('option').each(function(){
if (-1 !== $(this).html().indexOf(`(${name})`)) {
console.log('Comparing ' + $(this).html() + ' to ' + name + ".\n");
$(this).attr('selected', 'selected');
<?php
add_filter('woocommerce_billing_fields','wpb_custom_billing_fields');
// remove some fields from billing form
// ref - https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
function wpb_custom_billing_fields( $fields = array() ) {
unset($fields['billing_company']);
unset($fields['billing_address_1']);
unset($fields['billing_address_2']);
<?php
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );
/**
* WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
* @link https://www.skyverge.com/blog/checking-woocommerce-cart-contains-product-category/
* @link https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
* @link https://businessbloomer.com/woocommerce-hide-checkout-billing-fields-if-virtual-product-cart/
*/
parseJwt = (token: String) => {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse(window.atob(base64));
}
// Gererate Random Integer Array for demo data
getRandomSeries = (min, max) => {
const count = (this.item.range == 'MTD') ? this.dayArray.length - 1 : this.monthArray.length - 1;
let arr = [];
for (let i = 0; i < count; i++) {
arr.push(Math.floor(Math.random() * (max - min)) + min);
}
return arr;
}
{ "_id" : 8751, "title" : "The Banquet", "author" : "Dante", "copies" : 2 }
{ "_id" : 8752, "title" : "Divine Comedy", "author" : "Dante", "copies" : 1 }
{ "_id" : 8645, "title" : "Eclogues", "author" : "Dante", "copies" : 2 }
{ "_id" : 7000, "title" : "The Odyssey", "author" : "Homer", "copies" : 10 }
{ "_id" : 7020, "title" : "Iliad", "author" : "Homer", "copies" : 10 }
`Book` table above.
Write your code in the proposal to get this result from Book table, but you must use LARAVEL framework and Eloquent ORM model.
`Result` you need to get by query.
{ "author" : "Homer", "books" : [ "The Odyssey", "Iliad" ] }
@purplefeel
purplefeel / gist:757b4c98c1f254e467fb567c4a12689d
Created December 19, 2018 16:18
Result of <http://localhost:8080/api/alerts/1>
{
"id": 1,
"providerIssuedId": "12596362",
"alertTimestamp": "2016-09-30T18:00:00Z",
"alertDescriptor": "8887834233TODAYSHEALTH",
"saleTransactionAmount": 89.95,
"saleTransactionDate": "2016-09-19T17:00:00Z",
"saleTransactionId": null,
"saleTransactionCurrency": "USD",
"authCode": "57765B",