Skip to content

Instantly share code, notes, and snippets.

View shibayan's full-sized avatar
🩼
Broken left leg

Tatsuro Shibamura shibayan

🩼
Broken left leg
View GitHub Profile
@shibayan
shibayan / gist:2650881
Created May 10, 2012 03:35 — forked from buchizo/gist:2650720
Convert to DateTimeOffset from Json Date(Unix epoch)
/// <summary>
/// Convert to DateTimeOffset from Json Date(Unix epoch)
/// </summary>
/// <param name="jsondate">ex: "/Date(1324707957994+0900)/"</param>
/// <returns></returns>
public Nullable<DateTimeOffset> ConvertToDateTimeOffsetFromJsonDate(string jsondate)
{
if (String.IsNullOrEmpty(jsondate)) return null;
var match = Regex.Match(jsondate, @"^\/date\((\d*)([\+\-]?\d*)\)\/+$", RegexOptions.IgnoreCase);
public static class StringExtensions
{
public static string Format(this string format, params object[] args)
{
return string.Format(format, args);
}
}
public class RadixConvert
{
private const int Radix = 62;
private const string Table = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static string Encode(long number)
{
const int length = 16;
int index = length;
やりたいこと:
・object -> IList<object> への変換
・model が null の時には要素数が 0 の IList<object> にする
思い付いたコード:
初版
var values = new List<string>(((model as IEnumerable) ?? Enumerable.Empty<object>()).Cast<object>().Select(p => p.ToString()));
using System.Configuration;
namespace SwissKnife.T4
{
public static class AppSettings
{
public static string ClientValidationEnabled
{
get { return ConfigurationManager.AppSettings["ClientValidationEnabled"]; }
}
public class DateAttribute : DataTypeAttribute
{
public DateAttribute()
: base(DataType.Date)
{
}
public string MonthProperty { get; set; }
<ul id="hatena-bookmark" class="hatena-urllist"></ul>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js"></script>
<script>
!function ($, id, url) {
var ul = $(id);
ul.parent().prev().wrapInner('<a href="http://b.hatena.ne.jp/entrylist?url=' + url + '&sort=count"></a>');
$.getJSON("http://rss2json.azurewebsites.net/hatena/bookmark?callback=?", { url: url }, function (data) {
var list = [];
Uninstall-Package Microsoft.AspNet.WebApi
Uninstall-Package Microsoft.AspNet.WebApi.WebHost.ja
Uninstall-Package Microsoft.AspNet.WebApi.WebHost
Uninstall-Package Microsoft.AspNet.WebApi.Core.ja
Uninstall-Package Microsoft.AspNet.WebApi.Core
Uninstall-Package Microsoft.AspNet.WebApi.Client.ja
Uninstall-Package Microsoft.AspNet.WebApi.Client
ActiveAutoscaleProfile:
{
"Capacity": {
"Minimum": "1",
"Maximum": "3",
"Default": "1"
},
"Rules": [
{
ActiveAutoscaleProfile:
{
"Capacity": {
"Minimum": "1",
"Maximum": "3",
"Default": "1"
},
"Rules": [
{