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 getOS() { | |
var userAgent = window.navigator.userAgent, | |
platform = window.navigator.platform, | |
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], | |
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], | |
iosPlatforms = ['iPhone', 'iPad', 'iPod'], | |
os = null; | |
if (macosPlatforms.indexOf(platform) !== -1) { | |
os = 'Mac OS'; |
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 | |
/** | |
* Replace day number to day name | |
* @number int | |
*/ | |
function replaceNumberToString($number) | |
{ | |
$dowMap = array( | |
'понеділок', | |
'вівторок', |
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
//run command: | |
//php artisna tinker | |
//paste code and press enter | |
foreach(\DB::select('SHOW TABLES') as $table) { | |
$table_array = get_object_vars($table); | |
\Schema::drop($table_array[key($table_array)]); | |
} |
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 | |
$meters = 5302; | |
$miles = round($meters, 1, PHP_ROUND_HALF_UP); | |
echo $miles; |
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 | |
if ($request->hasFile('photos')) { | |
$allowedFileExtension = ['jpeg', 'jpg', 'png']; | |
$files = $request->file('photos'); | |
foreach ($files as $file) { | |
$extension = $file->getClientOriginalExtension(); | |
$check = in_array($extension, $allowedFileExtension); | |
if ($check) { |
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
CREATE TABLE `products` ( | |
`id` INT NOT NULL AUTO_INCREMENT, | |
`sku` varchar NOT NULL, | |
`title` varchar NOT NULL, | |
`description` TEXT NOT NULL, | |
`description_mini` TEXT NOT NULL, | |
`price` FLOAT NOT NULL, | |
`date` DATE NOT NULL, | |
`category_ids(JSON)` INT NOT NULL, | |
`payments_types(json)` INT NOT NULL, |
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 | |
/* | |
Api class for | |
https://ssl.easypay.by/merinfo/ | |
*/ | |
namespace App\Payments; | |
use GuzzleHttp\Exception\GuzzleException; | |
use GuzzleHttp\Client; |
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
rows = [ | |
['x', 'x', 'x', 'x', 'x'], | |
['x', 'x'], | |
['x'], | |
] | |
for rowIndex, row in enumerate(rows): | |
nextRowIndex = rowIndex+1 | |
if(nextRowIndex < len(rows)): | |
nextRow = rows[nextRowIndex] |
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
var search = require('./search.js'); | |
search('github').then(function (links) { | |
console.log(links) | |
}); |
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 old input value, and explode it by comma | |
* @param $key | |
* @return false|string | |
*/ | |
function oldList($key) | |
{ | |
return json_encode( |
OlderNewer