Skip to content

Instantly share code, notes, and snippets.

GuerrillaCoder

Block or report user

Report or block GuerrillaCoder

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
@GuerrillaCoder
GuerrillaCoder / _init
Last active Dec 30, 2019
NLog configuration
View _init
dotnet add package NLog.Web.AspNetCore
dotnet add package NLog
View Configure.HangfirePostgreSql.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Funq;
using Hangfire;
using Hangfire.Console;
using Hangfire.Dashboard;
using Hangfire.PostgreSql;
View postgresql import
public static string RunPsqlCsvImport(string filePath, string user, string dbname, string tableName, bool hasHeaderRow)
{
var isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
//WARNING: an entry for below connection must be entered in system pgpass.conf file or import will fail
ProcessStartInfo startInfo = null;
if (isLinux)
{
var args = $"-c \"cat {filePath} | psql -h 127.0.0.1 -U {user} -d {dbname} -w -c 'copy {tableName} from stdin csv header' \" ";
@GuerrillaCoder
GuerrillaCoder / JS-LINQ.js
Created Jul 13, 2018 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
View JS-LINQ.js
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
View Creating Neat .NET Core Command Line Apps.md

Creating Neat .NET Core Command Line Apps

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat console app. We'll get good practices, a help system and argument parsing for free. Oh, it also involves ninjas. Insta-win.

@GuerrillaCoder
GuerrillaCoder / StringInterpol.cs
Last active Aug 3, 2017
C# Named Value String Format Replace For Templating
View StringInterpol.cs
// This is a modification of https://mhusseini.wordpress.com/2014/05/03/fast-named-formats-in-c.
// To make it work as a flexible templating system I modified it so that it can use dynamic objects
// and silently removes unused fields.
// I am not sure how this has effected its performance.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
@GuerrillaCoder
GuerrillaCoder / setup.php
Last active Aug 29, 2015
Idea for set up structure
View setup.php
<?php
namespace themename\setup;
//todo: abstract actual values to another object and pass it to this contructor
class MainThemeSetupMaster
{
private $cssSetup;
private $jsSetup;
public function __construct()
{
You can’t perform that action at this time.