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 / analyse_seo.php
Last active February 14, 2022 16:29
Récupérer moteur, mot clé et page de la provenance du visiteur
<?php
function analyse($ref){
$refe = parse_url($ref);
parse_str($refe['query'], $query);
$host = $refe['host'];
switch ($host){
//GOOGLE
case (strpos($host, '.google.') !== false):
$moteur = "Google";
@titomus
titomus / functions.php
Last active February 13, 2022 17:29
Comment créer une page de capture virale
<?php
/*
CONFIG
*/
$get_email = 'Email';
$get_name = 'Name';
$get_referby = 'refby';
$site_name = 'Titre';
$site_slogan = 'Slogan';
@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 / get-search-num.php
Created August 10, 2017 07:17
Function pour récupérer le nombre de résultats Google (FR)
<?php
function get_search_num($keyword){
$url = sprintf('http://www.google.fr/search?pws=0&hl=fr&q=%s', $keyword);
$data = file_get_contents($url);
$pattern = sprintf(
'/%s(.*?)%s/',
preg_quote('Environ'),
preg_quote('résultats')
);