Sunday, April 6, 2014

Epic lines of code from the Wintercamp



Here are the, without a doubt, the most epic lines of code produced at the Nansen Wintercamp:

Andreas Nymark - LESS mixin:

.return( @size ) when ( @size = xlarge ) { 
    font-size: 60px;
}

Erik Nilsson - just code. Nothing else:

client.DownloadProgressChanged += (sender, args) => {
    if(args.TotalBytesToReceive <= 0) { // the server wont report file size so we cant show a loading bar
        progressBar.UpdateTimedProgress(DateTime.Now - downloadStarted, string.Format("unknown, {0} downloaded", ByteFomatter(args.BytesReceived)));
    }
    else { // update the loading bar
        var progress = (double)args.BytesReceived/args.TotalBytesToReceive;
        progressBar.Update((int)(progress*100));
    }

};

Johan Ahlin - IE fix:

<!DOCTYPE html>
<!--[if lt IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->


Rudde - initial drag-n-drop:

foo = document.createElement('foo')
foo.innerHTML = html;
ev.target.appendChild(foo)

while (foo.firstChild)
ev.target.insertBefore(foo.firstChild, foo)

ev.target.removeChild(foo)
modulesArray.push(data);


Sean Sullivan - TFS batch script: 

@ECHO OFF
tf checkin ./ /recursive /noprompt /comment:"%1"
ECHO "Your work is safe now."


Andreas Oldeskog - Commit message to simplyio/moduler.js:

"Release first public version, v0.1.0" 

Rob Strube & Arnold Macauley - Commerce Power Shell build script:

param($SolutionRootDir, $SolutionName)

#Get the solution as a EnvDTE80.Solution2 interface. People running < VS 2013 need not apply.  Upgrade your VS!
$solution2 = Get-Interface $dte.Solution ([EnvDTE80.Solution2])

#Build the Commerce Solution Folder, add the csproj
$commerceSolutionFolder = $solution2.AddSolutionFolder("Commerce")

$pathToCommerceManagerProj = $SolutionRootDir + "\Commerce\CommerceManager\CommerceManager.csproj";

#Note: .Object gives us the object as an [EnvDTE80.SolutionFolder]
$commerceSolutionFolder.Object.AddFromFile($pathToCommerceManagerProj);

$solutionSavePath = $SolutionRootDir + "\" + $SolutionName + ".sln"

$solution2.SaveAs($solutionSavePath)

Andreas Carlsson - php loop to build sitemap-strucure:

if ( isset($previousUrlFirstLevelName) && ( (count($urlSplit) == 1) && ($previousUrlFirstLevelName != $urlSplit[0]) ) ) {