Skip to content

Instantly share code, notes, and snippets.

View shibayan's full-sized avatar
🌀
Overworking

Tatsuro Shibamura shibayan

🌀
Overworking
View GitHub Profile
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js"></script>
<script>
!function ($) {
var range = 11, base = 90;
var data = [];
var list = $(".hatena-module-category ul li a");
list.each(function () {
data.push(parseInt($(this).text().match(/\((\d+)\)/)[1]));
});
var min = Math.min.apply(null, data), max = Math.max.apply(null, data);
@shibayan
shibayan / Web.config
Last active November 16, 2016 19:26
Web.config for Ruby on Rails Azure Web Sites
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandlerMain" modules="httpPlatformHandler" path="*" verb="*" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%RUBY_HOME%\bin\ruby.exe" arguments="%RUBY_HOME%\bin\thin -e production -p %HTTP_PLATFORM_PORT% -c '%RAILS_ROOT%' start" startupTimeLimit="60" startupRetryCount="5" />
</system.webServer>
</configuration>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace WebApplication27
{
public static class WebsiteEnvironment
{
public static bool IsAvailable => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"));
set PATH=%PATH%;D:\7zip
mkdir bin
cd bin
curl -L -O http://dl.bintray.com/oneclick/rubyinstaller/ruby-2.1.3-i386-mingw32.7z
7za x ruby-2.1.3-i386-mingw32.7z
rm -f ruby-2.1.3-i386-mingw32.7z
$.ajax({ type: "POST", url: "/api/settings", data: "{ \"hoge\": \"\1\" }", contentType: "application/json" });
@shibayan
shibayan / deploy.cmd
Created December 11, 2014 16:16
Custom Deployment Script for PHP composer
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.11
:: ----------------------
:: Prerequisites
:: -------------
@shibayan
shibayan / Web.config
Created December 29, 2014 13:44
SSL を強制する URL Rewrite 設定
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
@shibayan
shibayan / Program.cs
Created December 30, 2014 08:53
ストレージのパフォーマンスを簡単に調べるやつ
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace StorageBenchmark
{
class Program
{
static void Main(string[] args)
@shibayan
shibayan / Program.cs
Created December 30, 2014 15:44
今年書いた記事で読まれていないトップ 10 を出す
using System;
using System.Security.Cryptography.X509Certificates;
using Google.Apis.Analytics.v3;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
namespace ConsoleApplication5
{
class Program
@shibayan
shibayan / EnumerableExtensions.cs
Last active March 16, 2018 10:13
忘れやすい拡張メソッドまとめ
public static class EnumerableExtensions
{
// https://stackoverflow.com/questions/3210824/divide-array-into-an-array-of-subsequence-array/29462069
public static IEnumerable<IEnumerable<TSource>> Batch<TSource>(this IEnumerable<TSource> source, int size)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}