By Ryan Aunur Rassyid
Simplily create RESTful API with Google Script and store it to Google SpreadSheet like a Pro.
| #!/bin/bash | |
| # argument espanish or english | |
| echo -n "Installing latest wordpress, choose locale (en/es): ... " | |
| # wait for my input | |
| # read w1 | |
| echo "default locale: en" | |
| w1="en" |
| function sendEmail() { | |
| var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
| var currentsheet = spreadsheet.getSheetByName('Sheet1'); | |
| var data = currentsheet.getDataRange().getValues(); | |
| var html = HtmlService.createTemplateFromFile('TEMPLATE'); // create a html file, named template case sentitive | |
| var date = new Date(); | |
| //loop over each line |
| /** | |
| * @author: Svetto <https://devseon.com/en/wordpress-tutorials/woocommerce-add-a-paypal-unsupported-currency> | |
| */ | |
| add_filter( 'woocommerce_paypal_supported_currencies', 'add_a_paypal_valid_currency' ); | |
| function add_a_paypal_valid_currency( $currencies ) { | |
| array_push ( $currencies , 'DOP' ); // DOP = Dominican Peso. Please change to your country code here. | |
| return $currencies; | |
| } |
| /** | |
| * Takes a shortcode and content and returns an array of the partsed attributes of given shortcode | |
| * @param string $shortcode the shortcode in context | |
| * @param string $content the content where shortcode is found | |
| * @return bool|array FALSE if the given conditions are not met|ARRAY of key-values for the shortcode | |
| * @author Richard Blondet <http://richardblondet.com/> | |
| */ | |
| function parse_shortcodes_attributes( $shortcode, $content = '' ) { | |
| if( empty( $content ) ) return FALSE; | |
| String.prototype.formatUnicorn = String.prototype.formatUnicorn || function () { | |
| "use strict"; | |
| var str = this.toString(); | |
| if (arguments.length) { | |
| var t = typeof arguments[0]; | |
| var key; | |
| var args = ("string" === t || "number" === t) ? | |
| Array.prototype.slice.call(arguments) | |
| : arguments[0]; |
| # Local development file size upload | |
| php_value upload_max_filesize 5000M | |
| php_value post_max_size 2400M | |
| php_value memory_limit 600M | |
| php_value max_execution_time 600 | |
| php_value max_input_time 300 | |
| # Disabling anoying warnings | |
| # php_flag display_startup_errors off | |
| # php_flag display_errors off |
By Ryan Aunur Rassyid
Simplily create RESTful API with Google Script and store it to Google SpreadSheet like a Pro.
Inspired by this gist.
google-app-script-crud.gs in the default Code.gs file.SHEET_ID located in line 1 of your file.INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', '[email protected]', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');| /** New API */ | |
| const PlayerService = { | |
| getPlayerTeam: (playerId) => { | |
| return new Promise((resolve, reject) => { | |
| $.ajax({ | |
| url: `/player/${playerId}/team`, | |
| success: (data) => { | |
| resolve(data) | |
| }, | |
| error: (error) => { |