Skip to content

Instantly share code, notes, and snippets.

View tellmewys-blog-parts.html
<style>
#tell-me-wys-link {
position:fixed;
bottom:0;
right:-16.9em;
background-color: #fff;
border: solid 1px #ccc;
color:#444;
padding: 4px;
opacity:0.7;
@jsakamoto
jsakamoto / EmbeddedResourceFileSystem2.cs
Created May 31, 2014
EmbeddedResourceFileSystem2.cs
View EmbeddedResourceFileSystem2.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Owin.FileSystems;
public class EmbeddedResourceFileSystem2 : IFileSystem
{
protected readonly EmbeddedResourceFileSystem _fileSystem;
@jsakamoto
jsakamoto / xml.xml
Created Jun 23, 2014
How to enable Intelli Sense of .xml file by XSD on Visual Studio?
View xml.xml
<?xml version="1.0" encoding="utf-16"?>
<root
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="full/path/of/.xsd">
</root>
@jsakamoto
jsakamoto / HomeController.cs
Created Jun 18, 2015
How to turn on/off on Raspberry Pi GPIO port 25 by ASP.NET MVC action method.
View HomeController.cs
// use TinyGPIO.cs
// https://github.com/sample-by-jsakamoto/SignalR-on-RaspberryPi/blob/master/myapp/TinyGPIO.cs
using myapp;
using System.Web.Mvc;
public class HomeController : Controller
{
[HttpPut]
public ActionResult TurnOnLED()
{
@jsakamoto
jsakamoto / gist:1985918
Created Mar 6, 2012
gist にデビュー。
View gist:1985918
Console.WriteLine("Hello, World.");
@jsakamoto
jsakamoto / gist:2011416
Created Mar 10, 2012
GDataDB を使って、ASP.NET MVC3 アプリから Google Docs スプレッドシートへ書き込みを行う
View gist:2011416
// GDataDB を NuGet Package Manager を使ってプロジェクトに追加しておくこと。
[HttpPost]
public ActionResult Index(Attendee attendee)
{
// ここでスプレッドシートへ書き込み
var gdbclient = new GDataDB.DatabaseClient("(user name)", "(password)");
var db = gdbclient.GetDatabase("Attendees");
var tbl = db.GetTable<Attendee>("Sheet1");
tbl.Add(attendee);
@jsakamoto
jsakamoto / gist:2204346
Created Mar 26, 2012
count number of bits that type is integer. (by F#)
View gist:2204346
let rec numofbits bitwidth x =
match bitwidth with
|0 -> 0
|_ -> (x &&& 1) + numofbits (bitwidth - 1) (x / 2)
@jsakamoto
jsakamoto / summary.cs
Created Apr 3, 2012
sammary of CLRH Extra session-1 sample code.
View summary.cs
// http://atnd0.apphb.com/api/attendees
public class Attendee
{
public int AttendeeID { get; set; }
[Required, MaxLength(20)]
public string Name { get; set; }
[Required, MaxLength(20)]
@jsakamoto
jsakamoto / MyRemoteAttribute.cs
Created Apr 14, 2012
ASP.NET MVC Data Annotation Valiteion - Remote Validation with Server Side Validation!
View MyRemoteAttribute.cs
// NOTICE:
// This is "concept" sample code.
// Not enough resouce disposing, etc.
public class MyRemoteAttribute : RemoteAttribute
{
public RemotableCustomAttribute(string action, string controller) : base(action, controller)
{
}
@jsakamoto
jsakamoto / gist:3009448
Created Jun 28, 2012
rename all files by F#
View gist:3009448
open System;;
open System.IO;;
let dir = @"c:\workdir";;
Directory.GetFiles(dir)
|> Seq.map (fun x-> (x, x.Replace("original", "replaced")))
|> Seq.iter (fun (x,y) -> File.Move(x, y));;