Skip to content

Instantly share code, notes, and snippets.

@stofte
stofte / gist:6271588
Created August 19, 2013 17:15
ini file serializer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.IO;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Collections;
@stofte
stofte / gist:6455465
Created September 5, 2013 20:08
Efter du viste mig det der text tag så ville jeg lige prøve det, og der kan være god grund til Html.Raw umiddelbart. Se hvordan output bliver med hhv <text>, og med @Html.Raw. Raw laver ikke whitespace, <text> laver til gengæld nice html ;- ) Whitespace mellem elementer kan virkelig give hovedpiner i forhold til display, så jeg måtte gå tilbage …
code:
@for (var i = 0; i < list.Count; i++, index++)
{
...
<text><a href="@url" class="@className" title="@titleText">@linkText</a></text>
@Html.Raw(string.Format(template, url, className, linkText, titleText));
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
public interface IFoo
{
public ActionResult Bar()
{
return View();
}
public ActionResult _Bar()
{
var businessunits = Map2BusinessUnitCollection(UnityFactory.Instance.Resolve<IBusinessUnitService>().GetBusinessUnits());
var teams = Map2TeamViewModelCollection(UnityFactory.Instance.Resolve<ITeamService>().GetTeams());
Long link:
http://tlrobinson.net/projects/javascript-fun/jsondiff/#%7B%22d%22%3A%7B%22a%22%3A%22%7B%5Cn%20%20%20%20%5C%22UseOptimizedCacheKey%5C%22%3A%20true%2C%5Cn%20%20%20%20%5C%22Capabilities%5C%22%3A%20%7B%5Cn%20%20%20%20%20%20%20%20%5C%22canInitiateVoiceCall%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22isColor%5C%22%3A%20%5C%22true%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22supportsDivAlign%5C%22%3A%20%5C%22true%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22requiresFullyQualifiedRedirectUrl%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22requiresAttributeColonSubstitution%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22maximumRenderedPageSize%5C%22%3A%20%5C%22300000%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22backgroundsounds%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22requiresUniqueHtmlCheckboxNames%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%20%20%20%20%20%20%20%20%5C%22rendersBreakBeforeWmlSelectAndInput%5C%22%3A%20%5C%22false%5C%22%2C%5Cn%2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication
{
class Foo
{
@stofte
stofte / gist:ccb19c4b3d58dff96e69
Created June 12, 2015 20:39
Gulpfile that serves an app using browserify with babel to continually build es6/harmony/react with map files, continually inject less, using eslint as a linter. Has chrome flag that only transforms stuff Chrome doesn't support yet
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var eslint = require('gulp-eslint');
var gulpIf = require('gulp-if');
var less = require('gulp-less');
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps');
"frameworks": {
"dnxcore50": {
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
$counts = @{".cs"=0;".js"=0;".xml"=0;".config"=0}
$excludeList = @()
Get-ChildItem -Recurse | % {
$pathParts = $_.FullName.substring($pwd.path.Length + 1).split("\");
if ( ! ($excludeList | where { $pathParts -like $_ } ) ) { $_ }
} |
where { $_.FullName -ne $_.Directory -and $_.Extension -ne $null } |
foreach-object -process {
try {
if ($counts.ContainsKey($_.Extension)) {
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.DotNet.ProjectModel.Workspaces;
namespace ConsoleApplication
{