Skip to content

Instantly share code, notes, and snippets.

View mityukov's full-sized avatar

Vladimir Mityukov mityukov

  • Individual Entrepreneur
  • Ulyanovsk, Russia
  • X @pilat
View GitHub Profile
// A small sorting framework
//
// add this script to the page and then use this layout:
//
// <table data-has-sortables>
// <thead>
// <tr>
// <th data-is-sortable-by="field1">Field 1</th>
// <th data-is-sortable-by="field2">Field 2</th>
// </tr>
@mityukov
mityukov / gc_disable_comments.user.js
Created November 16, 2020 10:41
UserScript: Отключает комментарии при создании нового урока в GetCourse
// ==UserScript==
// @name GetCourse: disable comments by default
// @namespace https://github.com/mityukov
// @version 0.1
// @description Отключает комментарии при создании нового урока в GetCourse
// @author mityukov@gmail.com
// @match https://*/pl/teach/control/lesson/view?id=*
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
@mityukov
mityukov / helpers.php
Created October 14, 2019 17:17
Runtime cache for Laravel
<?php
// ...
/**
* Get / set the specified *runtime* cache value.
*
* If an array is passed, we'll assume you want to put to the cache.
* TLDR: same API as for `cache()`
*
@mityukov
mityukov / webpack.mix.js
Created November 16, 2018 05:53
Laravel Mix: strip console.log from production build
let mix = require('laravel-mix');
if (mix.inProduction()) {
mix.options({
uglify: {
uglifyOptions: {
compress: {
drop_console: true
}
}
@mityukov
mityukov / git-rsync.sh
Last active April 29, 2024 08:52
Sync only files, added or modified since last commit
#!/bin/bash
## Installation:
# - make a file, called `git-rsync` in a directory, covered by your $PATH variable;
# - `chmod a+x` this file.
# - do the same for `listfiles` script
#
## Usage:
# 1. Syncing "dirties" (all the files you can see in the `git status` output)
# - before commiting, issue `git-rsync login@host:/destination/path/` command to sync all local changes to your stage server
@mityukov
mityukov / xcrebuild.sh
Last active April 20, 2018 07:52
Script for rebuilding X-Cart 5 cache
# ATTENTION: Only works on local installations in Mac OS X (because of that `open` command in the end)
#
# INSTALLATION:
# 1. make sure it's placed in a directory, covered by your $PATH variable
# 2. re-name to xcrebuild (.sh is added to the filename only for syntax highlighting on Gist)
# 3. `chmod a+x /path/to/xcrebuild`
#
# USAGE: `cd xcart_dir && xcrebuild`
CONFIG_FILE=`([[ -f etc/config.local.php ]] && echo 'etc/config.local.php') || echo 'etc/config.php'`
@mityukov
mityukov / Xc5ValetDriver.php
Created March 19, 2018 03:58
X-Cart 5 Valet driver
<?php
class Xc5ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@mityukov
mityukov / helpers.php
Created January 23, 2018 09:53
Helpers to work with date in Laravel
<?php
function carbon($dateTime = null)
{
if (is_null($dateTime)) {
return \Carbon\Carbon::now();
}
if (is_numeric($dateTime)) { // timestamp is passed:
return \Carbon\Carbon::createFromTimestamp($dateTime);
@mityukov
mityukov / helpers.php
Last active January 13, 2018 03:18
array_undot() helper functon
<?php
function array_undot($dottedArray, $initialArray = [])
{
// to make it recursive:
$dottedArray = array_dot($dottedArray);
foreach ($dottedArray as $key => $value) {
array_set($initialArray, $key, $value);
}
// ==UserScript==
// @name Search site with google
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Kotique
// @match *food4vita.ru*
// @grant none
// ==/UserScript==