This file contains hidden or 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
#!/usr/bin/env python3 | |
# ----------------------------------------------------------------------------- | |
# MIT License | |
# | |
# Copyright (c) 2025 Samuel Guebo | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# ----------------------------------------------------------------------------- | |
# MIT License | |
# | |
# Copyright (c) 2025 Samuel Guebo | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# ----------------------------------------------------------------------------- | |
# MIT License | |
# | |
# Copyright (c) 2025 Samuel Guebo | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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"); |