Skip to content

Instantly share code, notes, and snippets.

@loburets
loburets / wrap.css
Last active July 6, 2017 10:35
Wrap from long words, strings
/*add max-width from table columns */
/* add this styles from wysywig window */
.overflow-long-text {
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
}
.overflow-long-text p {
@loburets
loburets / .php
Created February 12, 2016 07:30
php file downloading
<?php
function file_force_download($file) {
if (file_exists($file)) {
// сбрасываем буфер вывода PHP, чтобы избежать переполнения памяти выделенной под скрипт
// если этого не сделать файл будет читаться в память полностью!
if (ob_get_level()) {
ob_end_clean();
}
@loburets
loburets / .php
Created February 12, 2016 07:44
Universal path for apps with point of entry in root index.php
<?php
$path = realpath(dirname($_SERVER['SCRIPT_FILENAME']))
. DIRECTORY_SEPARATOR . 'dir' . DIRECTORY_SEPARATOR . $file . '.php';
@loburets
loburets / imagick.php
Last active May 23, 2017 06:34
check imagic
<?php
if (extension_loaded('imagick')) {
echo 'imagick is installed <br>';
} else {
echo 'imagick is not installed <br>';
}
if(class_exists("Imagick") ) {
echo 'class imagick is found <br>';
@loburets
loburets / trycatch.php
Last active September 22, 2017 07:24
try catch sample
try {
} catch (\Exception $exception) {
echo 'Error (File: ' . $exception->getFile() . ':'
. $exception->getLine() . '): ' . $exception->getMessage();
}
@loburets
loburets / non-responsive-bootstrap.css
Last active August 26, 2016 09:20
Non-responsive Bootstrap
/*
Non-responsive Bootstrap
If you need responsive delete this.
Don't forget:
add standart viewport
replace navbar
add col-md column instead col-xs if it need
current viewport:<meta name="viewport" content="width=device-width">
standart viewport:<meta name="viewport" content="width=device-width, initial-scale=1">
*/
@loburets
loburets / laraver route except all.php
Last active September 6, 2016 07:34
laraver resource route except all
Route::resource(
'year',
'YearController',
[
'except' => ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy']
]
);
@loburets
loburets / TitleComposer.php
Last active July 2, 2017 22:04
laravel titles
<?php
namespace App\Http\ViewComposers;
use Illuminate\View\View;
use App\Http\Requests;
class TitleComposer
{
@loburets
loburets / bootstrap dropdown submenu
Last active August 26, 2016 09:21
bootstrap dropdown submenu
<li class="dropdown-submenu action-menu-item">
<span href="#" class="dropdown-toggle" data-toggle="dropdown">
Point
</span>
<ul class="dropdown-menu">
Some points
</ul>
</li>
@loburets
loburets / WpFunctions.php
Last active August 29, 2016 11:12
wordpress and laravel integration
<?php
/**
* File with functions called in the wordpress site by including this file
*
* Name all functions by prefix "Lr" for clear understanding in the wordpress code
*/
//init laravel
require __DIR__.'/../../bootstrap/autoload.php';