Skip to content

Instantly share code, notes, and snippets.

View cristianraiber's full-sized avatar
🏠
Working from home

Raiber Cristian cristianraiber

🏠
Working from home
View GitHub Profile
@CharlyWargnier
CharlyWargnier / GTP3_script_for_sheets.txt
Created January 15, 2023 15:00
A script to integrate GTP3 in Google Sheets
const OPENAI_API_KEY = ""; // <- PASTE YOUR SECRET KEY HERE
const OPENAI_API_URL = "https://api.openai.com/v1/completions";
/**
* Submits a prompt to GPT-3 and returns the completion
*
* @param {string} prompt Prompt to submit to GPT-3
* @param {float} temperature Model temperature (0-1)
* @param {string} model Model name (e.g. text-davinci-002)
@polevaultweb
polevaultweb / dbi-woo-slack-command.php
Last active May 15, 2019 12:51
WooCommerce Slack Slash Command WordPress plugin
<?php
add_action( 'rest_api_init', function () {
register_rest_route( 'dbi', 'slash-woo/', array(
'methods' => 'POST',
'callback' => 'slack_woo_command',
) );
} );
function slack_woo_command( $request ) {
$command = filter_input( INPUT_POST, 'command', FILTER_SANITIZE_STRING );
@mathetos
mathetos / site-health-curl-test.php
Last active May 9, 2019 18:53
Add cURL test to WP 5.2 Site Health tests
<?php
/**
* Adds a cURL version test to Site Health
*
* Info here: https://make.wordpress.org/core/2019/04/25/site-health-check-in-5-2/
* NOTE: Requires version 5.2+ of WordPress
*
**/
@davekiss
davekiss / gist:2639184ac066c53416b23c5a66f42d1e
Created February 2, 2019 17:44
EDD Weekly Domain Report via Email
/**
* Add a weekly email report that summarizes which domains that
* your products are being used on.
*/
add_filter( 'cron_schedules', function( $schedules ) {
$schedules['weekly'] = array(
'interval' => 604800,
'display' => __('Once Weekly')
);
@stephywells
stephywells / Void Shareasale transaction from EDD
Last active July 6, 2020 07:03
Void Shareasale commission when EDD payment is refunded
function s11_void_refunded( $payment ) {
global $edd_options;
if ( empty( $payment->ID ) ) {
return;
}
$merchant_id = $edd_options['sas_affiliate_id']; // TODO: If not using the EDD Shareasale addon, replace with your affiliate id
$api_token = 'aflj24sadflk3'; // TODO: Set API token here
$secret_key = 'asldkjlj12312oiksdlfksld'; // TODO: Set secrect key
@anttiviljami
anttiviljami / wp-admin-modal-dialog.php
Last active January 5, 2024 14:25
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@remcotolsma
remcotolsma / README.md
Last active December 21, 2023 14:13
WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more

Brew

http://brew.sh/

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
@amejiarosario
amejiarosario / static_server.js
Created August 24, 2016 21:49
Node.js quick file server (static files over HTTP) using es6+
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
@slushman
slushman / customizer-links.php
Last active September 23, 2023 13:03
How to link into the WordPress Customizer
@nishanths
nishanths / main.js
Last active August 7, 2019 23:46
Electron tray: Drag and Drop events demo
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var appIcon = null;
app.on('ready', function(){
// image is null, so image will not be shown in menu bar
// so click around on the system menu bar to locate the space where the tray icon is
appIcon = new Tray(null);