Skip to content

Instantly share code, notes, and snippets.

progmars

Block or report user

Report or block progmars

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@progmars
progmars / Program.cs
Last active Aug 7, 2019
Issue with applying Where conditions from generic classes after Select()
View Program.cs
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
namespace ProjectionCriteria
{
public interface ISomeable
@progmars
progmars / dotenv_2_mt_reliability_workaround_vendor.patch
Created Mar 17, 2016
Workaround for Dotenv and issues with concurrent requests failing (especially on Windows) because of PHP threaded getenv/putenv implementation. To make this really work, use `getEnvironmentVariable` instead of `getenv` everywhere (e.g. Laravel's `env()` helper, as in the patch https://gist.github.com/progmars/5c18235360c04b621ed7 ).
View dotenv_2_mt_reliability_workaround_vendor.patch
This is a workaround patch for `getenv()` unstable behavior in multithreaded "PHP as Apache module" environments
(e.g. some prepackaged WAMP stacks).
See
https://github.com/vlucas/phpdotenv/issues/76
https://github.com/vlucas/phpdotenv/issues/163
This fix is intended only for development environments, the same as Dotenv itself.
The paths are based on Composer's vendor directory.
diff --git a/vendor/vlucas/phpdotenv/src/Dotenv.php b/vendor/vlucas/phpdotenv/src/Dotenv.php
index 0737a70..d734a8b 100644
--- a/vendor/vlucas/phpdotenv/src/Dotenv.php
@progmars
progmars / laravel_5_x_getenv_dotenv_mt_reliability_workaround.patch
Last active Mar 18, 2016
Workaround for Dotenv and Laravel 5.x issues with concurrent requests failing (especially on Windows) because of PHP threaded getenv/putenv implementation. To make this work on Laravel, you will need also https://gist.github.com/progmars/1e545d96dd48676a2aa7 patch.
View laravel_5_x_getenv_dotenv_mt_reliability_workaround.patch
This is a workaround patch for `getenv()` unstable behavior in multithreaded "PHP as Apache module" environments
(e.g. some prepackaged WAMP stacks).
See
https://github.com/vlucas/phpdotenv/issues/76
https://github.com/vlucas/phpdotenv/issues/163
This fix is intended only for development environments, the same as Dotenv itself.
In production, you should use Laravel's `config:cache` command to avoid `env` helper and Dotenv altogether.
The paths are based on Composer's vendor directory.
diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
index 673ce3a..f250729 100644
View Basic unit-of-work for Laravel
Simple contract or interface, call as you wish:
interface UnitOfWork
{
public function begin();
public function commit();
public function rollback();
}
@progmars
progmars / dotenv_1_1_1_concurrent_fix_vendor.patch
Last active Mar 10, 2016
Fix for Dotenv 1.1.1 and Laravel 5.1.7 issues with concurrent requests failing because of PHP threaded getenv/putenv implementation. This fix does not work for Laravel 5.2, see https://gist.github.com/progmars/5c18235360c04b621ed7 for the L5.2 fix.
View dotenv_1_1_1_concurrent_fix_vendor.patch
Fix for Dotenv and Laravel issues with concurrent requests failing because of PHP threaded getenv/putenv implementation.
diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
index de5939e..715673d 100644
--- a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
+++ b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
@@ -625,10 +625,15 @@ if (!function_exists('env'))
*/
function env($key, $default = null)
{
@progmars
progmars / laravel_5_1_7_session_write_improvements_vendor.patch
Created Jul 15, 2015
For Laravel 5.1.7. Improvement to prevent writing session data even if it has not changed. Improvement to specify session metadata update frequency in session configuration instead of updating on every request. These both improvements will also reduce the risk for race conditions for concurrent requests.
View laravel_5_1_7_session_write_improvements_vendor.patch
Improvement to prevent writing session data even if it has not changed.
Improvement to specify session metadata update frequency in session configuration instead of updating on every request.
These both improvements will also reduce the risk for race conditions for concurrent requests.
Also, add 'metadata_update_threshold' => 1, to your config/session.php
diff --git a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
index edf34b8..0b5b763 100644
--- a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
+++ b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
@@ -22,12 +22,13 @@
@progmars
progmars / session_write_improvements.patch
Last active Dec 15, 2015
For Laravel 5.0.27. Improvement to prevent writing session data even if it has not changed. Improvement to specify session metadata update frequency in session configuration instead of updating on every request. These both improvements will also reduce the risk for race conditions for concurrent requests.
View session_write_improvements.patch
Improvement to prevent writing session data even if it has not changed.
Improvement to specify session metadata update frequency in session configuration instead of updating on every request.
These both improvements will also reduce the risk for race conditions for concurrent requests.
Also, add 'metadata_update_threshold' => 1, to your config/session.php
diff --git a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
index edf34b8..0b5b763 100644
--- a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
+++ b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php
@@ -20,13 +20,14 @@
@progmars
progmars / dotenv_concurrent_fix.patch
Last active May 19, 2016
Fix for Dotenv 1.1.0 and Laravel 5.0.27 issues with concurrent requests failing because of PHP threaded getenv/putenv implementation.
View dotenv_concurrent_fix.patch
Fix for Dotenv and Laravel issues with concurrent requests failing because of PHP threaded getenv/putenv implementation.
diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
index de5939e..715673d 100644
--- a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
+++ b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
@@ -603,9 +603,14 @@ if ( ! function_exists('env'))
*/
function env($key, $default = null)
{
You can’t perform that action at this time.