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 gcd(a, b) | |
return a if b.zero? | |
gcd(b, a % b) | |
end | |
puts gcd(1071, 1029) # => 21 |
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 extgcd(a, b) | |
if b.zero? | |
{x: 1, y: 0, gcd: a} | |
else | |
prev = extgcd(b, a % b) | |
{ x: prev[:y], | |
y: prev[:x] - (a / b) * prev[:y], | |
gcd: prev[:gcd] } | |
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
<html> | |
<head> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#more_load').bind('click', function() { | |
var offset = $(this).data('offset'); | |
var limit = $(this).data('limit'); |
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
# rails_restart.sh is simple shell program. you can get somewhere. | |
require 'webrick' | |
require 'json' | |
server = WEBrick::HTTPServer.new(Port: 8000, ServerType: WEBrick::Daemon) | |
server.mount_proc '/' do |req, res| | |
req_json = JSON.parse(req.body) | |
if req_json["ref"] == "refs/heads/master" |
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
.gh-header-meta .commit-ref:first-of-type:not([title*='master']) { | |
background: #dbab09; | |
} |
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
// Usage | |
// yarn add puppeteer | |
// node puppeteer_sample.js | |
const puppeteer = require('puppeteer'); | |
puppeteer.launch({ | |
headless: false, // フルバージョンのChromeを使用 | |
slowMo: 300 // 何が起こっているかを分かりやすくするため遅延 | |
}).then(async browser => { |
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
#!/bin/bash | |
## Usage | |
## app_icon_set_sips.sh Icon.png | |
mkdir -p icons 2>/dev/null | |
sips -z 20 20 --out icons/[email protected] $1 | |
sips -z 40 40 --out icons/[email protected] $1 | |
sips -z 60 60 --out icons/[email protected] $1 | |
sips -z 29 29 --out icons/[email protected] $1 | |
sips -z 58 58 --out icons/[email protected] $1 |
OlderNewer