Skip to content

Instantly share code, notes, and snippets.

View christopherpickering's full-sized avatar
👍
on extended leave

sur.la.route christopherpickering

👍
on extended leave
View GitHub Profile
@madskristensen
madskristensen / ETagMiddleware.cs
Last active March 18, 2024 15:11
ASP.NET Core ETAg middleware
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
public class ETagMiddleware
{
@brizandrew
brizandrew / README.md
Created July 28, 2017 22:07
How to use node.js build routines and npm packages in Django.

Using Node.js With Django

When writing django apps it's easy to ignore the organization of your front end code. Often, these backend coders will just write a static js and css file, stick it in the static directory, and call it a day.

You can also build them as two completely independent parts. With a complex gulp build routine independent of the django app. But if you don't know gulp, node, or those kinds of systems it can be a daunting process to get started with.

Enter django-compressor-toolkit (the name doesn't quite roll off the tongue).

Setting Up Django-Compressor-Toolkit

Using django-compressor and django-compressor-toolkit you can write Javascript ES6 code with all its fancy import/export logic or style your pages with sass instead of css, and leave your deploy routine largely untouched.

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@k-maru
k-maru / format.cs
Last active April 16, 2024 00:47
T-SQL Format C# Code
class Program {
static void Main(string[] args) {
var query = "select A.ID, A.NAME from (select ID, NAME from BAR) A where A.ID = '1'";
var parser = new TSql120Parser(false);
IList<ParseError> errors;
var parsedQuery = parser.Parse(new StringReader(query), out errors);
if (errors.Count > 0) {
foreach (var err in errors) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(err.Message);
@ebouchut
ebouchut / disable_postgres_autostart_on_macos
Created April 16, 2014 08:42
Disable Postgres (installed with Homebrew) autostart on MacOS
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist