Skip to content

Instantly share code, notes, and snippets.

View ganchclub's full-sized avatar

Anatolii G ganchclub

View GitHub Profile
@bladeSk
bladeSk / laravel-on-shared-hosting-htaccess.md
Last active June 12, 2024 14:40
Deploying Laravel on a shared hosting using only .htaccess

Deploying Laravel on a shared hosting using only .htaccess

Making Laravel work on a shared hosting can be troublesome, because Laravel needs to have its document root set to the public directory. This may not be configurable by a user or even desirable, when the server is hosting multiple websites.

Here's a simple method using only a .htaccess file placed in Laravel's root directory - e.g. alongside app, bootstrap, config, ... No changes whatsoever are necessary to your code.

The file rewrites all the requests so that requesting /file.png would in fact return /public/file.png and anything else is routed to /public/index.php. This also ensures that nothing outside the public folder can be accessed, thereby protecting any sensitive files like .env or database/*.

The simple method

@mivxxx
mivxxx / translate_selected.md
Last active March 20, 2023 14:02
Отображение перевода выделенного текста в системном уведомлении Ubuntu

Отображение перевода выделенного текста в системном уведомлении Ubuntu

Исходная статья, описывающая механизм перевода текста из выделения

https://habrahabr.ru/post/137215/ В исходной статье скрипт для перевода из командной строки устарел (google блокирует подключения не из браузера), поэтому предлагается использовать translate-shell.

Установка

Требования

  1. утилита для отправки уведомлений из командной строки notify-send
  2. утилита для получения содержимого выделения xsel
@zachflower
zachflower / tor_curl.php
Last active March 15, 2024 15:02
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter