Skip to content

Instantly share code, notes, and snippets.

View roartalent's full-sized avatar

P roartalent

View GitHub Profile
@andypols
andypols / ntlm.js
Created May 3, 2013 19:37
Javascript to create the type1, type3 messages you need to communicate with an ntlm server. I used this to talk to a NTLM enabled windows server from a node.js application.
var url = require('url');
var crypto = require('crypto');
/*
NTLM PROCESS FOR GET REQUESTS:
==============================
STEP 1: The Client requests a protected resource from the server
STEP 2: The Server responds with a 401 status, with a header indicating that the client must authenticate
STEP 3: The Client resubmits the request with an Authorization header containing a Base-64 encoded Type 1 message. From this point forward, the connection is kept open; closing the connection requires reauthentication of subsequent requests.
@gherkins
gherkins / silverstripe_duplicate_relations.php
Created March 10, 2012 23:41
Silverstripe – has_many- and many_many-relations when duplicating pages
<?php
public function duplicate() {
$items_to_duplicate = array(
'Images',
'Somehting'
);
$page = parent::duplicate();