Skip to content

Instantly share code, notes, and snippets.

const SECRET_KEY = ENTER YOUR SECRET KEY HERE;
const MAX_TOKENS = 200;
// For more cool AI snippets and demos, follow me on Twitter: https://twitter.com/_abi_
/**
* Completes your prompt with GPT-3
*
* @param {string} prompt Prompt
* @param {number} temperature (Optional) Temperature. 1 is super creative while 0 is very exact and precise. Defaults to 0.4.
@mevdad
mevdad / .htaccess
Created January 25, 2023 09:35 — forked from Sixl-Daniel/.htaccess
.htaccess for Quasar
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@mevdad
mevdad / 00.howto_install_phantomjs.md
Created November 14, 2022 20:09 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@mevdad
mevdad / nginx_nodejs.md
Created October 26, 2020 02:42 — forked from tomasevich/nginx_nodejs.md
Сервер в связке Nginx + NodeJs

Сервер в связке Nginx + NodeJs

Данная пошаговая инструкция поможет освоить основы на простом примере

Для справки

Сервер поднимался на Debian 8 c характеристиками:

CPU - 1 ядро x 500 МГц

@mevdad
mevdad / CropAllImages.php
Created May 25, 2017 20:37
CropAllImages
<?php
$files = glob("uploads/posts/**/*.*");
foreach($files as $file){
$filename = $file;
// тип содержимого
header('Content-Type: image/jpeg');
@mevdad
mevdad / .htaccess
Created May 22, 2017 13:17
Expires headers
<ifModule mod_expires.c>
ExpiresActive On
# Cache Images
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
@mevdad
mevdad / wp_head to string
Created April 8, 2017 10:28
wp_head to string
<?
function wpse251841_wp_head() {
ob_start();
wp_head();
return ob_get_clean();
}
?>
@mevdad
mevdad / padezhidays.php
Created March 1, 2017 13:25
Padezhi Days
/**
* Склонение существительных с числительными.
* Функция принимает число $n и три строки -
* разные формы произношения измерения величины.
* Необходимая величина будет возвращена.
* Например: pluralForm(100, "рубль", "рубля", "рублей")
* вернёт "рублей".
*
* @param int величина
* @param string форма1
@mevdad
mevdad / scrolltotop.js
Created February 13, 2017 18:49
ScrollToTop
$(window).scroll(function(){
var scrollTop = $("html").scrollTop() ? $("html").scrollTop() : $("body").scrollTop();
if(scrollTop > 100){
$("a[href='#top']").fadeIn("600");
}else{
$("a[href='#top']").fadeOut("600");
}
});
@mevdad
mevdad / custom_post_per_page.php
Created February 10, 2017 14:51
Custom Post Per Page WP
function set_posts_per_page_for_towns_cpt( $query ) {
if ( is_tax( 'faq-cat' ) ) {
$query->set( 'posts_per_page', '10' );
}
}
add_action( 'pre_get_posts', 'set_posts_per_page_for_towns_cpt' );