This file contains 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 (var file = new System.IO.StreamReader(script)) { | |
var fileContent = file.ReadToEnd(); | |
if (scriptType == ScriptType.Stylesheet) { | |
var fromUri = new Uri(context.Server.MapPath("~/")); | |
var toUri = new Uri(new FileInfo(script).DirectoryName); | |
var relativeUri = fromUri.MakeRelativeUri(toUri); | |
fileContent = fileContent.Replace("url(", "url(/" + relativeUri.ToString() + "/"); | |
} | |
scriptbody.Append(fileContent); | |
} |
This file contains 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
on :channel, /^#{self.nick} roll (\d*)d(\d+)($|[\+\-]\d+$)/ do |m, n, d, mod| | |
total = 0; | |
dice = n.to_i == 0 ? 1 : [n.to_i.abs, 10].min | |
dice.times do | |
result = (Random.new).rand(1..d.to_i.abs) | |
m.reply "#{m.user.nick} rolls a #{result}" | |
total += result | |
end | |
unless mod.to_i == 0 |
This file contains 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
on :message, /(.*)/ do |m, text| | |
url = "http://127.0.0.1:1337/?text=#{URI.escape(text)}" | |
result = open(url).read | |
m.reply "That's what she said!" if result == 'true' | |
end |
This file contains 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
dates.OrderBy(date => date.Date).GroupBy(d => d.Date).Select(list => list.OrderByDescending(date => date.TimeOfDay)).SelectMany(x => x); |
This file contains 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.Collections.Generic; | |
namespace FollowMyBuild.Web.Models.ViewModels.Portable { | |
public class PortableRecursiveComment { | |
public PortableRecursiveComment() { | |
Comments = new List<PortableComment>(); | |
} | |
public int Id { get; set; } | |
public IEnumerable<PortableComment> Comments { get; set; } | |
} |
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using Dapper; | |
namespace Example.Data.Dapper { | |
public class MessageRepository : RepositoryBase, IMessageRepository { | |
/// <summary> | |
/// Gets a single message | |
/// </summary> |
This file contains 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 static class TapExtension { | |
public static T Tap<T>(this T obj, Action<T> block) { | |
block.Invoke(obj); | |
return obj; | |
} | |
} | |
This file contains 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
#If you're in a folder with a solution file, it'll open the solution - otherwise it'll just open Visual Studio | |
Set-Alias vs "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" | |
function vso { | |
$SolutionFile = @(gci *.sln)[0] | |
vs $SolutionFile | |
} |
This file contains 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
NSError *error = nil; | |
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\n]+|(?<=embed\\/)[^\"&\n]+|(?<=(?:v|i)=)[^&\n]+|(?<=youtu.be\\/)[^&\n]+" options:NSRegularExpressionCaseInsensitive error:&error]; | |
NSString *link = [post objectForKey:@"link"]; | |
NSTextCheckingResult *match = [regex firstMatchInString:link options:0 range:NSMakeRange(0, [link length])]; | |
NSString *identifier = [link substringWithRange:match.range]; | |
NSString *html = [self embedYouTube:identifier frame:webView.frame]; | |
[webView loadHTMLString:html baseURL:nil]; |
This file contains 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.Collections.Generic; | |
using System.Configuration; | |
using System.IO; | |
using System.Linq; | |
using Amazon; | |
using Amazon.S3; | |
using Amazon.S3.Model; | |
using N2.Engine; |