Skip to content

Instantly share code, notes, and snippets.

View moradi-morteza's full-sized avatar
💭
I may be slow to respond.

Developer moradi-morteza

💭
I may be slow to respond.
  • Tehran,Qom
View GitHub Profile
@moradi-morteza
moradi-morteza / ssl.php
Created May 27, 2020 08:14
[ssl service]
// in htaccess file add this file
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@moradi-morteza
moradi-morteza / larav.php
Last active April 16, 2020 13:34
[laravel+vujs] #LaravelT
//https://router.vuejs.org/
// resources app.js
window.Vue = require('vue');
// router ----------https://router.vuejs.org/
import VueRouter from 'vue-router'
Vue.use(VueRouter);
let routes = [
@moradi-morteza
moradi-morteza / cache.php
Last active April 11, 2020 07:07
[cache] #LaravelT
folder config/cache.php // you can write cache on file,database
// --------------Cache of File ---------------------
Cache.put("key","value",1); // remain in minutes
Cache.add("key","value",1); // if exist key befor it not add new value
Cache.get("key","default");
Cache.get("key",function(){}); // you can write function if key not exist
Cache.has("key") // check if cache with key exist or not
Cache.increament("key",1); // add 1 to key , for counter page ; you can do not write 1
Cache.decreament("key",1); // mins 1 **** and return new value ******
@moradi-morteza
moradi-morteza / server.php
Last active January 5, 2021 14:49
server config
-in nginx.conf(inside /opt/nginx/conf)
client_max_body_size 24000M
systemctl restart nginx
---------------------------------------------------------------
sudo usermod -aG www-data deploybot
sudo chown -R www-data:www-data /var/www/laravel
sudo chown -R www-data:www-data /var/www/laravel/public/uploads
sudo chmod -R 775 /var/www
---------------------------------------------------------------
@moradi-morteza
moradi-morteza / init_laravel.php
Last active August 1, 2020 14:05
Laravel To Serve
laravel new blog
laravel new blog --auth // with auth
php artisan key:generate
composer insall
composer dump-autoload
npm install
npm run dev
@moradi-morteza
moradi-morteza / ajax.jquery.js
Last active June 28, 2020 06:07
ajax.jquery
https://api.jquery.com/jquery.ajax/
$.ajax({name:value, name:value, ... })
complete(xhr,status) A function to run when the request is finished (after success and error functions)
success(result,status,xhr) A function to be run when the request succeeds
error(xhr,status,error) A function to run if the request fails.
data Specifies data to be sent to the server
// you install js package with npm this command install one version of library to folder node_modules
// then type : npm run dev : this command check file resurse/sass/app.sass and get all require name library and add all js code to file publie/js/app.js
// now you can use lib to your project
// for example when you install and then add @import '~bootstrap/scss/bootstrap'; it added to your project
//***** if you look at file package.json in bootstrap folder in node/moudols you can see (jquery) this mean that jquery is installed in your project with bootstrap - if you want to use it you should add <scrip src:"{{asset('js/app.js')}}"></script>
// in file welcome.blade.php app.js not added but in file layout/app.blade.php it is.
@moradi-morteza
moradi-morteza / composer.php
Last active January 31, 2020 17:00
[composer]
// composer is a php package manager
@moradi-morteza
moradi-morteza / git.md
Last active March 19, 2021 06:54
[git]

sudo apt install git-all sudo apt-get remove git sudo apt-get remove --auto-remove git // with dependencys // If you also want to delete configuration and/or data files of git from Ubuntu Trusty then this will work: sudo apt-get purge git sudo apt-get purge --auto-remove git // with dependencys

git config --global user.name YOUR_USRE_NAME // set username

@moradi-morteza
moradi-morteza / website-scraper.php
Created January 12, 2020 13:11
[Website Scraper]
https://ourcodeworld.com/articles/read/374/how-to-download-the-source-code-js-css-and-images-of-a-website-through-its-url-web-scraping-with-node-js
npm install website-scraper
// create a file index.js
const scrape = require('website-scraper');
let options = {