Skip to content

Instantly share code, notes, and snippets.

View lukencode's full-sized avatar
🙃

Luke Lowrey lukencode

🙃
View GitHub Profile
@lukencode
lukencode / boxstarter.ps1
Last active August 29, 2015 14:08
Boxstarter
#####################
# BEGIN CONFIGURATION
#####################
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
#region Initial Windows Config
@lukencode
lukencode / CacheExtensions.cs
Created December 1, 2014 00:50
CacheExtensions
public static class CacheExtensions
{
static object sync = new object();
/// <summary>
/// Executes a method and stores the result in cache using the given cache key. If the data already exists in cache, it returns the data
/// and doesn't execute the method. Thread safe, although the method parameter isn't guaranteed to be thread safe.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="cache"></param>
{
"name": "austechjobs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "cross-env ASPNETCORE_ENVIRONMENT=Development NODE_ENV=development dotnet run",
"watch": "webpack --watch --mode=development",
"build": "webpack --mode=production --optimize-minimize",
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const outputDir = './wwwroot/dist'
const entry = './wwwroot/js/app.js'
const cssOutput = 'site.css'
module.exports = (env) => {
return [{
@lukencode
lukencode / HomPageService.cs
Last active May 20, 2018 23:45
LazyCache Example
public class HomePageService
{
public static string HomeModelCacheKey = "HomeModel";
private static TimeSpan cacheExpiry = new TimeSpan(12, 0, 0); //12 hours
private readonly PositionsGroupedByTagQuery positionsGroupedByTagQuery;
private readonly IAppCache cache;
public HomePageService(PositionsGroupedByTagQuery positionsGroupedByTagQuery, IAppCache cache)
{
@lukencode
lukencode / Startup.cs
Created July 2, 2018 10:25
FluentEmail dependency injection
public void ConfigureServices(IServiceCollection services)
{
services
.AddFluentEmail("defaultsender@test.test")
.AddRazorRenderer()
.AddSmtpSender("localhost", 25);
}
@lukencode
lukencode / sql.json
Created August 18, 2020 06:08
Azure Data Studio - User snippets
{
// Place your snippets for sql here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",