http://localhost:1337/user POST {"userId":"zoi","username":"Aoba Suzukaze"}
デフォルトだとcookieを保存しないので自前で保存してやれば良い
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 Mock<DbSet<T>> CreateMockSet<T>(IQueryable<T> src) | |
where T: class | |
{ | |
var mockSet = new Mock<DbSet<T>>(); | |
mockSet.As<IQueryable<T>>().Setup(m => m.Provider).Returns(src.Provider); | |
mockSet.As<IQueryable<T>>().Setup(m => m.Expression).Returns(src.Expression); | |
mockSet.As<IQueryable<T>>().Setup(m => m.ElementType).Returns(src.ElementType); | |
mockSet.As<IQueryable<T>>().Setup(m => m.GetEnumerator()).Returns(src.GetEnumerator()); | |
return mockSet; | |
} |
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
#!/usr/bin/env ruby | |
if `git branch`.chomp.split("\n").find { |e| e == '* master' } | |
puts 'ここはmasterブランチ。許可のないやつは通せないぜ > 乂・д・)' | |
exit false | |
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
def hoge(a, b, c, e, n) | |
[a, b, c, e, n].reject(&:nil?).each(&:strip!) | |
p a | |
p b | |
p c | |
p e | |
p n | |
end | |
hoge("a ", "b ", " c ", "", 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
# http://qiita.com/HKDnet/items/57a0630705d3f6468a77 | |
# $Env:MackerelApiKey is needed | |
function Get-MackerelHosts { | |
$ret = Invoke-RestMethod -Uri "https://mackerel.io/api/v0/hosts.json" -Headers @{ "X-Api-Key" = $Env:MackerelApiKey } | |
return $ret.hosts | |
} | |
function Get-MackerelServices { | |
$ret = Invoke-RestMethod -Uri "https://mackerel.io/api/v0/services" -Method GET -Headers @{ "X-Api-Key" = $Env:MackerelApiKey} |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class Hello{ | |
public static void Main(){ | |
var rnd = new Random(); | |
var zn = "ズン"; | |
var dk = "ドコ"; | |
var expected = "ズンズンズンズンドコ"; |
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
hoge |
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
(function() { | |
let opts = document.querySelectorAll('#templates option'); | |
let filters = [ | |
/* 除外したいオプションの正規表現を何個か書く */ | |
]; | |
[...opts].forEach(e => { | |
if (filters.some(f => f.test(e.innerText))) { | |
e.parentElement.removeChild(e); | |
} | |
}); |
OlderNewer