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
# https://youtube.com/c/cognitivesurge | |
export ZSH="/Users/karl/.oh-my-zsh" | |
ZSH_THEME="robbyrussell" | |
plugins=( | |
git | |
bundler | |
dotenv | |
osx |
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
// https://github.com/PButcher/flipdown | |
import { FlipDown } from 'flipdown'; |
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
public static class DataTableExtensions | |
{ | |
public static List<T> ToList<T>(this DataTable table) where T : new() | |
{ | |
IList<PropertyInfo> properties = typeof(T).GetProperties().ToList(); | |
List<T> result = new List<T>(); | |
foreach (var row in table.Rows) | |
{ | |
var item = CreateItemFromRow<T>((DataRow)row, properties); |
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
public interface ISystemService | |
{ | |
bool IsRunningInDebugMode(); | |
} | |
public class SystemService : ISystemService | |
{ | |
private bool _debugging; | |
public bool IsRunningInDebugMode() |
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
/* Transformation Examples */ | |
// Ternary example | |
<%# !string.IsNullOrEmpty((string)Eval("ItemToTest")) ? "True" : "False" %> | |
<%# !String.IsNullOrEmpty(Eval("ItemToTest").ToString()) ? "True" : "False" %> | |
<%# !string.IsNullOrEmpty((string)Eval("CatalogLink")) ? "<p>For detailed curriculum and more, please visit the <a href=\"" + Eval("CatalogLink") + "\" target=\"_blank\">Course Catalog entry</a> for this program.</p>" : Eval("CatalogDescription") + "<br /><br /><strong>For detailed curriculum and more please visit the <a onclick=\"_gaq.push(['_trackEvent', 'Link', 'Click' 'Course Catalog Adult Education'])\" target=\"_blank\" href=\"" + Eval("CatalogLink") + "\">Course Catalog entry</a> for this program.</strong><br />" %> | |
<%# !String.IsNullOrEmpty(Eval("ScheduleOfBenefitsDownload").ToString()) || !String.IsNullOrEmpty(Eval("ProviderNetwork").ToString()) ? "<strong>Resources</strong><br>" : "" %> | |
/* ********** */ |
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
SELECT S.name as 'Schema', | |
T.name as 'Table', | |
I.name as 'Index', | |
DDIPS.avg_fragmentation_in_percent, | |
DDIPS.page_count | |
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS DDIPS | |
INNER JOIN sys.tables T on T.object_id = DDIPS.object_id | |
INNER JOIN sys.schemas S on T.schema_id = S.schema_id | |
INNER JOIN sys.indexes I ON I.object_id = DDIPS.object_id | |
AND DDIPS.index_id = I.index_id |
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
Test-NetConnection <address> -p <port_number> |
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
/// <summary> | |
/// A cache wrapper that invalidates multiple objects based on string dependency keys. | |
/// </summary> | |
public class DefaultCacheHelper : ICacheHelper | |
{ | |
private readonly IMemoryCache _cache; | |
private readonly ILogger<DefaultCacheHelper> _logger; | |
private readonly CacheSettingsConfig _cacheSettingsConfig; | |
// a place to hold cancellation tokens to invalidate the cache | |
private static readonly ConcurrentDictionary<string, CancellationTokenSource> _cancellationTokens = new ConcurrentDictionary<string, CancellationTokenSource>(); |
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
--query store status | |
SELECT actual_state_desc, desired_state_desc, current_storage_size_mb, | |
max_storage_size_mb, readonly_reason | |
FROM sys.database_query_store_options; | |
--top 10 bad runners. This gives you the query ID to search for the query in SSMS->Query Store->Tracked Queries. Type in the ID, get details on the query. | |
SELECT TOP 10 | |
qt.query_text_id, | |
q.query_id, | |
p.plan_id, |
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
# Push to multiple remotes | |
# To do this, choose a remote ID which will refer to all the remotes. | |
# I usually call it all, but there are developers who prefer origin. | |
# The idea is to add all the remote repo URLs as “push URLs” to this remote. | |
# Here’s what you do: | |
# Create a new remote called "all" with the URL of the primary repo. | |
git remote add all git@github.com:jknopp/toggl2redmine.git | |
# Re-register the remote as a push URL. | |
git remote set-url --add --push all git@github.com:jknopp/toggl2redmine.git | |
# Add a push URL to a remote. This means that "git push" will also push to this git URL. |