Skip to content

Instantly share code, notes, and snippets.

View Azerothian's full-sized avatar

Matthew Mckenzie Azerothian

View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active July 3, 2024 18:04
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@bariloce
bariloce / Blobbed.cs
Last active March 5, 2024 21:29
NHibernate, Fluent.NHibernate and PostgreSql: How to map PostgreSql Json type using Fluent.NHibernate
[Serializable]
public class Blobbed<T> : IUserType where T : class
{
public new bool Equals(object x, object y)
{
if (x == null && y == null)
return true;
if (x == null || y == null)
return false;
@constantology
constantology / process.logger.js
Created July 24, 2014 09:39
using node's process to emit events to log stuff from anywhere
// use like this:
// process.emit( 'app:log', module, arg1, arg2, ..., argN );
var Module = require('module');
function logConsole(method, module) {
var args = [(new Date()).toJSON(), method];
var index = 1;
if (module instanceof Module) {
@spion
spion / bluebird.d.ts
Last active January 2, 2016 16:08
Beta
// Type definitions for bluebird
// Project: https://github.com/petkaantonov/bluebird
// Definitions by: Gorgi Kosev
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "bluebird" {
@gcollazo
gcollazo / Backbone.sync_csrftoken.js
Created September 25, 2011 14:56
This is what I did to insert the CSRF token in backbone requests. This works with django.
var oldSync = Backbone.sync;
Backbone.sync = function(method, model, options){
options.beforeSend = function(xhr){
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN);
};
return oldSync(method, model, options);
};