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
export type Result<T, E> = Success<T> | Failure<E> | |
export interface IResult<T, E> { | |
isSuccess(): boolean | |
} | |
export class Success<T> implements IResult<T, never> { | |
constructor(private value: T) { } | |
isSuccess(): boolean { | |
return true |
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
'use strict'; | |
var https = require('https'); | |
var url = require('url'); | |
exports.handler = (event, context) => { | |
console.log(event); | |
var user = event.user_name; | |
var command = event.command; |
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
'use strict'; | |
var AWS = require('aws-sdk'); | |
var qs = require('querystring'); | |
var url = require('url'); | |
var https = require('https'); | |
var token, kmsEncyptedToken; | |
kmsEncyptedToken = "<kmsEncryptedToken>"; |
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
class Array | |
def each2 | |
for i in self | |
yield i | |
end | |
end | |
def each3(&block) | |
for i in self | |
block.call i | |
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
radius = ARGV[0] || 10 | |
radius = radius.to_i | |
result = [] | |
height = (radius * 2) - 1 | |
height.times do |i| | |
if i < radius | |
half = "-" * radius | |
half[radius - (i + 1)] = "*" |
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
ruby dk.rb init | |
[INFO] found RubyInstaller v1.9.1 at C:/Ruby191 | |
Initialization complete! Please review and modify the auto-generated 'config.yml' file to ensure it contains the root directories to allof the installed Rubies you want enhanced by the DevKit. | |
# pikを使っている場合 | |
# C:\Users\[UserName]\.pik\config.yml に記載されているパスを/binを取り除いて | |
# "193: ruby 1.9.3p125 (2012-02-16) [i386-mingw32]": | |
# :path: !ruby/object:Pathname |
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
require 'youtuber' | |
# developer_key などをセットしてGDataオブジェクトを作成 | |
gdata = YouTubeR::GData.new("<email@google.com>", "<password>", "<developer_key>", "<app_name>") | |
# search_feeds メソッドでは YoutubeAPI の検索パラメータが使える | |
# https://developers.google.com/youtube/2.0/reference?hl=ja#Searching_for_videos | |
# ここで返ってくるのは YoutubeAPIの生のレスポンス | |
xml_videos_feed = gdata.search_feeds(:q => "git", :orderby => "viewCount", :"max-results" => 10) |
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
require 'rubygems' | |
require 'test/unit' | |
require 'shoulda' | |
require 'mocha' | |
lib_files = File.join(File.dirname(__FILE__), "..", "lib") | |
Dir.glob(File.join(lib_files, "**")).each do |file| | |
require file | |
end |