Skip to content

Instantly share code, notes, and snippets.

async function writeAboutTest(prompt,keywords = 'vie,ce que',exemple= '1.', engine = "davinci-instruct-beta-v3") { //text-davinci-002
let text = "";
/*
1. intro
2. sous titre
content
sous titre
content
3. conclusion
@titomus
titomus / bonnespratiques.js
Created March 27, 2022 08:45
Bonnes pratiques JS
/*
Class js avec private vars
*/
class Person {
name = '';
//private vars
#age = 0;
#ageInDogYears = 0;
@titomus
titomus / cache_wp.php
Created February 28, 2022 16:20
Cache WordPress sur index.php directement
<?php
/**
* Class Compress
*/
class Compress {
// methode basique de compression utile pour html, css, js
public static function compress_inline($code) {
return preg_replace(
array(
@titomus
titomus / is-alive-backlink.php
Created February 16, 2022 08:46
Is alive backlink
@titomus
titomus / string-between.php
Created February 13, 2022 16:07
GEt String Between
<?php
function getStringBetween($p_string, $p_from, $p_to, $p_multiple=false){
//checking for valid main string
if (strlen($p_string) > 0) {
//checking for multiple strings
if ($p_multiple) {
// getting list of results by end delimiter
$result_list = explode($p_to, $p_string);
//looping through result list array
foreach ( $result_list AS $rlkey => $rlrow) {
@titomus
titomus / gsuggest.php
Created February 13, 2022 15:52
Google Suggest scraper
<?php
function ggSuggest($word, $lang = 'fr', $spin = false){
$word = urlencode(trim($word));
$words = array();
$apicall = ("https://www.google.com/complete/search?output=toolbar&q=$word");
$result = utf8_encode(file_get_contents($apicall));
$resp = simplexml_load_string($result);
if ($resp){
foreach ($resp as $t) {
@titomus
titomus / spin.js
Created February 13, 2022 11:08
Content Spinning JS
function spin(txt){
var matches = txt.match(/{([^{}]*)}/g);
if (!matches) return txt;
for (i in matches) {
spin = matches[i]+'';
ori_spin = spin;
spin = spin.replace("{", "").replace("}", "");
spin_strs = spin.split('|');
txt = txt.replace(ori_spin,spin_strs[Math.floor(Math.random() * spin_strs.length)]);
@titomus
titomus / name-to-url.php
Created February 13, 2022 11:03
Seo name to url
function seo_name($title) {
return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($title))));
}
@titomus
titomus / redirect.php
Created February 13, 2022 11:01
Redirection PHP
<?php
header("Status: 301 Moved Permanently", false, 301);
header("Location: http://www.exemple.net/repertoire/page.php");
exit();
@titomus
titomus / breadcrumbs-wordpress.php
Last active February 13, 2022 10:52
breadcrumbs Wordpress
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';