This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.12.0; | |
use warnings; | |
use File::stat; | |
my $dir_name = shift; | |
if ( not defined $dir_name ) { | |
die qq(Usage: $0 <directory>); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@helper RenderLink(string href, string title, string target, string text) | |
{ | |
<a href="@(href)" title="@(title)" target="@(target)">@(text)</a> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string relativeUrl = "/home"; | |
string returnValue = string.Format("{0}://{1}{2}{3}", current.Scheme, current.Host, | |
current.Port == 80 ? "" : ":" + current.Port, relativeUrl) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Car{ | |
public int Id {get; set;} | |
public string Make {get; set;} | |
public string Model {get; set;} | |
} | |
private string Get | |
var enumerableCollection = new List<Car>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetRidOfUnprintablesAndUnicode(string inpString) | |
{ | |
return inpString.Where(ch => ((int) (byte) ch) >= 32 & ((int) (byte) ch) <= 128).Aggregate(String.Empty, (current, ch) => current + ch); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetXmlValue(string responseUrl) | |
{ | |
return responseUrl.Split('>')[1].Split('<')[0]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.Entity; | |
namespace Website.Models.Logging | |
{ | |
public class Log | |
{ | |
public int LogId { get; set; } | |
public DateTime TimeStarted { get; set; } | |
public int Total { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string GetXmlElementFromUrl(string url, string elementName) | |
{ | |
byte[] data; | |
using (var webClient = new WebClient()) | |
data = webClient.DownloadData(url); | |
string str = Encoding.GetEncoding("Windows-1252").GetString(data); | |
XDocument xmlDoc = XDocument.Parse(str); | |
var donation = new Donation(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public byte[] Register(string url, string emailAddress, string firstName, string lastName) | |
{ | |
var swr = new StringWriter(); | |
var xws = new XmlWriterSettings {OmitXmlDeclaration = true}; | |
using (XmlWriter xwr = XmlWriter.Create(swr, xws)) | |
{ | |
xwr.WriteStartElement("register"); | |
xwr.WriteAttributeString("email", emailAddress); | |
xwr.WriteAttributeString("firstname", firstName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.12.0; | |
use warnings; | |
use File::Spec; | |
use File::stat; | |
my $dirname = shift; | |
my $ext = 'mp4'; | |
my $basename = "file"; | |
my $count = 1; | |
my $new; |