Skip to content

Instantly share code, notes, and snippets.

View ulcuber's full-sized avatar

Victor S. ulcuber

  • FrameWorkTeam
  • GMT+4
View GitHub Profile
@ulcuber
ulcuber / routes.php
Last active July 25, 2018 08:07
Illuminate\Routing\RouteRegistrar
<?php
/*
* use Illuminate\Routing\RouteRegistrar@group instead of Illuminate\Routing\Router@group
*/
Route::domain('')
->middleware('')
->namespace('Product')
->prefix('products')
->as('products.')
@ulcuber
ulcuber / route.php
Created July 27, 2018 20:33
Shorter way
<?php
// assume
Route::resource('groups.students', 'StudentController');
// Instead of this
route('groups.students.show', ['group' => $group->id, 'student'=> $student->id]);
// use this
route('groups.students.show', [$group, $student]);
@ulcuber
ulcuber / pgadmin.conf
Last active October 5, 2018 10:53
WSGI Python pgAdmin vhost
<VirtualHost *:80>
ServerName
WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=__VENV_PATH__
WSGIScriptAlias / /opt/pgAdmin4/web/pgAdmin4.wsgi
<Directory /opt/pgAdmin4/web>
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
Require all granted
[Unit]
Description=Pgadmin4 Service
After=network.target
[Service]
User= root
Group= root
# Point to the virtual environment directory
WorkingDirectory=__VENV_PATH__
# Point to the bin folder of your virtual environment
#!/usr/bin/env bash
# run with sudo -H
HELP="Missing params\nsudo -H bash pgAdmin.sh <user> <host>"
APACHE_SITES="/etc/apache2/sites-available"
USER=${1}
if [[ -z ${USER} ]]; then
echo -e ${HELP}
@ulcuber
ulcuber / get_query_with_bindings.php
Last active May 17, 2019 08:47
Convert laravel Builder to string with bindings
<?php
if (!function_exists('get_query_with_bindings')) {
function get_query_with_bindings($query): string
{
$sql = $query->toSql();
$replace = '?';
$replaceLength = strlen($replace);
foreach ($query->getBindings() as $binding) {
if (!is_int($binding)) {
@ulcuber
ulcuber / .eslintrc.js
Created March 19, 2019 10:07
TypeScript+React eslint config for create-react-app project
// npm i --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'plugin:@typescript-eslint/recommended',
'react-app',
@ulcuber
ulcuber / jq.js
Created March 22, 2019 12:05
to make external libs rely on one jquery
const jq = {
get() { return jQuery; },
set() { },
};
Object.defineProperty(window, '$', jq);
Object.defineProperty(window, 'jQuery', jq);
@ulcuber
ulcuber / regexp.php
Created March 23, 2019 05:53
using cyrillic in php regexp
<?php
/*
* about task
* strings like "Artist1 & Artist2" or "Artist1 feat. Artist2" or "Исполнитель1 и Исполнитель2"
* are splited into ["Artist1", "Artist2"]
*/
/*
* using modifier u (PCRE_UTF8) to include cyrillic in regexp
* @see http://php.net/manual/en/reference.pcre.pattern.modifiers.php
@ulcuber
ulcuber / SSR_starters.md
Last active May 14, 2019 15:38
Compare create-react-app | create-next-app | create-razzle-app
scripts create-react-app create-next-app create-razzle-app
dev server npm start npm run dev npm start
prod server - npm run start npm run start:prod
build npm run build npm run build npm run build
test npm test - npm test
eject npm run eject - -
features create-react-app create-next-app create-ruzzle-app