Skip to content

Instantly share code, notes, and snippets.

Avatar

Joey Green joeygreen

View GitHub Profile
View galileo.js
var g = 'Galileo';
for (i = 0; i < 5; i++){
if (i % 2 == 0) { console.log(g.toUpperCase()); }
else { console.log(g.toLowerCase()); }
if (i == 4) { console.log("Figaro!"); }
};
console.log('Magnifico!');
View RenderViewToString.cs
public static string RenderViewToString(ControllerContext context, string viewName, object model)
{
if (string.IsNullOrEmpty(viewName))
viewName = context.RouteData.GetRequiredString("action");
ViewDataDictionary viewData = new ViewDataDictionary(model);
using (StringWriter sw = new StringWriter())
{
ViewEngineResult viewResult = ViewEngines.Engines.FindPartialView(context, viewName);
View Superior.cs
divRollup.InnerHtml = "<strong>Using Employee.Manager(s)</strong><br /><br />";
if (emp.Manager != null)
{
divRollup.InnerHtml += "1 - " + emp.Manager.EmployeeFullName + "<br />";
if (emp.Manager.Superior != null)
{
divRollup.InnerHtml += "2 - " + emp.Manager.Superior.FullName + "<br />";
if (emp.Manager.Superior.Superior != null)
View lowercase urls - add this to your global.asax.cs
public void Application_BeginRequest(Object sender, EventArgs e)
{
// Check url
if (Regex.IsMatch(HttpContext.Current.Request.Url.ToString(), @"[A-Z]") == true)
{
// Lowercase url
String lower = HttpContext.Current.Request.Url.ToString().ToLower();
View gist:328363
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Text;
using NUnit.Framework;
using Sandow.LuxeSource.Models;
namespace Sandow.LuxeSource.Tests
{