This file contains hidden or 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
| module IntegerPartition | |
| def zs1 | |
| n = self | |
| fail 'positive integer only' if n <= 0 | |
| Enumerator.new do |yielder| | |
| yielder << [n] | |
| x = [1] * n | |
| x[0] = n | |
| m = 0 |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/vue/0.10.6/vue.min.js"></script> | |
| <script src="//rawgit.com/flatiron/director/master/build/director.min.js"></script> | |
| <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <meta charset="utf-8"> | |
| <title>SUGOI 50 Checker</title> | |
| </head> | |
| <body> |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <meta charset="utf-8"> | |
| <title>漢字の線に囲まれた部分だけを塗りつぶした画像で何の四字熟語か当てる画像を作る</title> | |
| <script src="http://jsrun.it/assets/k/P/F/1/kPF1v"></script> | |
| <style> | |
| canvas { | |
| border: 1px #ccc solid; |
This file contains hidden or 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
| document.getElementsByClassName('watch').forEach(function (a) { a.href = a.href.split("?")[0] }) |
This file contains hidden or 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* zs1(n) { | |
| "use strict"; | |
| if (n <= 0) throw new Error('positive integer only'); | |
| yield [n]; | |
| var x = new Array(n); | |
| x[0] = n; | |
| for (var i = 1; i < n; i++) x[i] = 1; |
This file contains hidden or 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
| const CONAMI = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; | |
| let array_equal = (arr1, arr2) => JSON.stringify(arr1) === JSON.stringify(arr2); | |
| Kefir | |
| .fromEvents(document, 'keydown') | |
| .map((ev) => ev.keyCode) | |
| .slidingWindow(CONAMI.length, CONAMI.length) | |
| .filter((keycodes) => array_equal(keycodes, CONAMI)) | |
| .onValue((keycodes) => alert('Konami Code')); |
This file contains hidden or 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
| FROM alpine:latest | |
| RUN apk add --update \ | |
| build-base \ | |
| openssl \ | |
| curl \ | |
| ruby \ | |
| ruby-dev \ | |
| ruby-bundler \ | |
| imagemagick \ | |
| imagemagick-dev && \ |
This file contains hidden or 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
| hands = %w(G C P G) | |
| puts hands[(hands.index(gets.chomp)||0) + 1] |
This file contains hidden or 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
| module Lottery | |
| class << self | |
| def draw(probablity_rates, upper_limit = 10000) | |
| chosen_value = rand(0...upper_limit) | |
| probablity_rates.find_index{|probablity_rate| | |
| chosen_value -= probablity_rate | |
| chosen_value < 0 | |
| } | |
| end | |
| end |
This file contains hidden or 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 ok | |
| puts "ok" | |
| true | |
| end | |
| def ng | |
| puts "ng" | |
| false | |
| end |