This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendPayStubReminder() { | |
const monthYear = new Date().toLocaleString('en-us',{month:'long', year:'numeric'}) | |
const senderName = "YOUR-NAME" | |
const recipientName = "THEIR-NAME" | |
const recipientEmail = "[email protected]" | |
const subject = `Need stamped payslip (${monthYear})` | |
const cc = "[email protected],[email protected]" | |
let emailBody = `Hello ${recipientName},<br><br/>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
import json | |
import requests | |
import csv | |
import os | |
from datetime import datetime, date, time | |
""" | |
Wiki replicas credentials, update with your own | |
See how to obtain these here: https://wikitech.wikimedia.org/wiki/Help:Toolforge/#Database#Connecting_to_the_database_replicas_from_your_own_computer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* "Active Users" are registered users who have made at least | |
* one edit in the last thirty days. | |
*/ | |
let apiURI = 'https://meta.wikimedia.org/w/api.php?action=parse&page=List%20of%20Wikipedias&origin=*&format=json' | |
fetch(apiURI) | |
.then(res => res.json()) | |
.then(data => { | |
data = data.parse.text['*'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Author: Samuel Guebo | |
# reference: https://codex.wordpress.org/Class_Reference/wpdb | |
# Description: A simple snippet to display WordPress posts as in CSV (comma separated format). | |
# The script uses WPDB class and can accessed directly if put in the Website's root (/script.php) | |
// Include WordPress core features | |
require_once("wp-blog-header.php"); | |
// Leverage WPDB class, utility for perfoming DB actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$rawUrl = "https://pastebin.com/raw/fjmQKxnQ"; | |
$rawText = file_get_contents($rawUrl); | |
$lines = preg_split("/\r\n|\n|\r/", $rawText); | |
$lines_count = count($lines); | |
$output = array(); | |
$i = 0; | |
for($j = 0; $j<$lines_count; $j++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkFacebookReactions($url){ | |
// Generate a token https://elfsight.com/blog/2017/10/how-to-get-facebook-access-token/ | |
$access_token = "YOUR-FACEBOOK-TOKEN"; | |
$api_url = 'https://graph.facebook.com/v3.0/?id=' . urlencode( $url ) . '&fields=engagement&access_token=' . $access_token; | |
$fb_connect = curl_init(); // initializing | |
curl_setopt( $fb_connect, CURLOPT_URL, $api_url ); | |
curl_setopt( $fb_connect, CURLOPT_RETURNTRANSFER, 1 ); // return the result, do not print | |
curl_setopt( $fb_connect, CURLOPT_TIMEOUT, 20 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 compatibility | |
require("isomorphic-fetch") | |
// Set default api url | |
var apiUrl = 'https://randomuser.me/api/?results=10' | |
fetch(apiUrl).then(response => { | |
return response.json(); | |
}).then(data => { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this line at the very begining of the header.php of your active theme. | |
// And just launch your website url in your browser. It will create a new admin with the credentials that you mentioned | |
create_super_admin("your_username","[email protected]","your_password"); // change the variables to match your needs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add thumbnail to post columns in Dashboard | |
```php | |
add_image_size( 'admin-list-thumb', 80, 80, false ); | |
function wpcs_add_thumbnail_columns( $columns ) { | |
if ( !is_array( $columns ) ) | |
$columns = array(); | |
$new = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Au lieu d'utiliser les variables de $_POST j'ai remplacé par des variables statiques | |
A toi de t'assurer que ces données là sont bien envoyées et de les sécuriser: se referer au lien ci-dessous | |
http://code.tutsplus.com/articles/data-sanitization-and-validation-with-wordpress--wp-25536 | |
*/ | |
function insert_into_db_test() { | |
global $wpdb; | |
$id=addslashes("001"); | |
$idreservation=addslashes("001"); |