This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcYear(yearRes, monthStr) | |
{ | |
const month = parseInt(monthStr); | |
const curMonth = (new Date).getMonth(); | |
const curYear = (new Date).getFullYear(); | |
yearStr = yearRes === undefined | |
? calcYear(monthStr) | |
: (yearRes.length === 4 ? yearRes : '20' + yearRes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GetCourse: disable comments by default | |
// @namespace https://github.com/mityukov | |
// @version 0.1 | |
// @description Отключает комментарии при создании нового урока в GetCourse | |
// @author [email protected] | |
// @match https://*/pl/teach/control/lesson/view?id=* | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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()` | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mix = require('laravel-mix'); | |
if (mix.inProduction()) { | |
mix.options({ | |
uglify: { | |
uglifyOptions: { | |
compress: { | |
drop_console: true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Xc5ValetDriver extends ValetDriver | |
{ | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_undot($dottedArray, $initialArray = []) | |
{ | |
// to make it recursive: | |
$dottedArray = array_dot($dottedArray); | |
foreach ($dottedArray as $key => $value) { | |
array_set($initialArray, $key, $value); | |
} |
NewerOlder