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
/* | |
Credit: https://stackoverflow.com/questions/7048839/sql-server-query-to-find-all-permissions-access-for-all-users-in-a-database#answer-30040784 | |
Security Audit Report | |
1) List all access provisioned to a SQL user or Windows user/group directly | |
2) List all access provisioned to a SQL user or Windows user/group through a database or application role | |
3) List all access provisioned to the public role | |
Columns Returned: | |
UserType : Value will be either 'SQL User', 'Windows User', or 'Windows Group'. |
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 | |
$json = <<<EOT | |
{"PASTE_YOUR":"JSON_HERE"} | |
EOT; | |
echo '[' . PHP_EOL; | |
jsonToArray(json_decode($json, true), 1); | |
echo ']'; |
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 | |
namespace App; | |
use Laravel\Scoute\Builder; | |
use Illuminate\Http\Request; | |
abstract class QueryFilters | |
{ | |
/** |
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 | |
Str::macro('sentences', function($value, $sentences = 2, $end = '...') | |
{ | |
preg_match('/(.+?(?:(?<![\s.]\p{Lu})[.!?])){1,'.$sentences.'}/u', $value, $matches); | |
if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { | |
return $value; | |
} |
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
<style> | |
.wrapper { | |
position: relative; | |
} | |
.sidebar, .content { | |
min-height: 100%; | |
} | |
</style> |
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 scaleObject(object, w_factor, h_factor) | |
{ | |
var scaleX = object.scaleX; | |
var scaleY = object.scaleY; | |
var left = object.left; | |
var top = object.top; | |
var tempScaleX = scaleX * w_factor; | |
var tempScaleY = scaleY * h_factor; | |
var tempLeft = left * w_factor; |
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
$file_name = 'anything'; | |
$rel_path = 'uploads/' . str_slug($file_name) . '.csv'; | |
$full_path = public_path($rel_path); | |
$f = fopen($full_path, 'w'); | |
$firstLineKeys = false; | |
Model::select('data', 'data2')->chunk(500, function($entries) use ($f, $firstLineKeys) { | |
$array = json_decode(json_encode($entries), 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
use Carbon\Carbon; | |
public function getCreatedAtAttribute($value) | |
{ | |
//fixes 0000-00-00 00:00:00 date to return 1970-01-01 09:30:00 instead of -0001-11-30 00:00:00 | |
return Carbon::createFromTimeStamp($value)->toDateTimeString(); | |
} |
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 namespace Themes\Pharmacy4u\Models\Traits; | |
trait InsertIgnoreModelTrait | |
{ | |
public static function insertIgnore($values){ | |
$self = new static(); | |
$query = $self->newBaseQueryBuilder(); | |
if (empty($values)) return true; |
NewerOlder