Skip to content

Instantly share code, notes, and snippets.

@jz5
jz5 / index.html
Last active August 29, 2015 14:17
<script>
// (省略)
function onAuthenticated(token, authWindow) {
if (token) {
if (authWindow) {
removeLoginButton();
authWindow.close();
}
Function FileStream(url As String) As ActionResult
Try
Dim req = HttpWebRequest.CreateHttp(url)
Dim res = DirectCast(req.GetResponse, HttpWebResponse)
Response.ContentType = res.ContentType
res.GetResponseStream.CopyTo(Response.OutputStream)
Catch ex As WebException
If ex.Status = System.Net.WebExceptionStatus.ProtocolError Then
If Request.UrlReferrer Is Nothing OrElse Request.UrlReferrer.Host <> Request.Url.Host Then
Response.StatusCode = HttpStatusCode.BadRequest
Return New EmptyResult
End If
Function Image() As ActionResult
Dim path = Server.MapPath("~/App_Data/images/")
Dim bmp = New Bitmap(IO.Path.Combine(path, "sample.png"))
Dim ms = New MemoryStream()
bmp.Save(ms, Imaging.ImageFormat.Png)
bmp.Dispose()
ms.Position = 0
Return New FileStreamResult(ms, "image/png")
public class Hello{
public static void Main(){
// Here your code !
System.Console.WriteLine("Hello C#");
///aaa
}
}
// 現時刻の status id
var currentId = Convert.ToInt64(
DateTime.UtcNow.Subtract(
new DateTime(1970, 1, 1).AddMilliseconds(1288834974657)
).TotalMilliseconds
) << 22;
// 10 minutes 分のミリ秒
var offset = Convert.ToInt64(
TimeSpan.FromMinutes(10).TotalMilliseconds) << 22;
function twcm_get_description()
{
global $post;
$twcm_options=twcm_get_options();
//$desc=trim(get_the_excerpt());
//if($desc=="")
//{
//$desc=$post->post_content;
' NG
tokens.Statuses.Update(Function(status As String) "hello")
' OK
tokens.Statuses.Update({Function(status As String) "hello"})
tokens.Statuses.Update(status => "hello");
// スキーマ定義
var JSRel = require("jsrel");
var db = JSRel.create("dbname", {schema:
{ user: { name : true, is_activated: "on", $uniques: "name"},
book: { title: true, price: 1, author: "user", $indexes: "title" },
}});
// データの挿入
if (!db.loaded) { // if loaded from saved data, omits this section
var u1 = db.ins('user', {name: 'shinout'});