Skip to content

Instantly share code, notes, and snippets.

View get amazon kindle ranking
require'nokogiri'
require'open-uri'
body = open("https://www.amazon.co.jp/gp/bestsellers/digital-text/2293143051", &:read)
doc = Nokogiri::HTML(body)
doc.xpath("//div[@class='zg_itemRow']")
View gist:a2b7371f554557fce5907c08e6925574
mimetypeを取得
let mimeType:String = UTTypeCopyPreferredTagWithClass(string as! CFString, kUTTagClassMIMEType)!.takeRetainedValue() as String
@colorbox
colorbox / git-commit-word-extractor
Created Apr 14, 2017
git log commit message extract
View git-commit-word-extractor
git rev-list --format=oneline --max-count=10000 HEAD
View heroku-log
heroku logs --tail -a your-app-name
@colorbox
colorbox / curl-with-basic
Created Apr 14, 2017
curl with basic and jq
View curl-with-basic
curl -X PUT --user "id:pass" -d "user[current_password]=XXXXXXXX&user[password]=new_XXXXXXXX" https://XXXXXX.com |jq .
View gist:f737c8bd60a288c897f4d7c537fcd9df
list = "AAAA"
(for x <- String.split(list,"")|>Enum.drop(-1), do: ([0,0,0] ++ Integer.digits(elem(Code.eval_string("0x"<>x),0),2))|>Enum.take(-4) )|> List.flatten()|> Enum.join()
View gist:a31fc38819e67c078f1f658c5f30cddb
defmodule Executor do
def exec do
Solver.test("44165,44516", "false")
Solver.test("26265,31436", "true")
Solver.test("46345,54215", "true")
Solver.test("62143,11152", "false")
Solver.test("4242,4314,1562", "false")
Solver.test("5612,3656,4523", "false")
Solver.test("5514,1311,5252", "false")
Solver.test("5262,4631,2644", "true")
@colorbox
colorbox / fox.rb
Last active Dec 9, 2017
バーチャルのじゃロリ狐娘Youtuberおじさん
View fox.rb
def words
[
'Youtuber',
'バーチャル',
'のじゃロリ',
'おじさん',
'狐娘',
'ケモミミ',
'おばさん',
'底辺',
View parse_with_comments
require 'parser/current'
str = <<-FOO
def hoge
# this is comment
pp"this is test"
end
FOO
Parser::CurrentRuby.parse_with_comments str
View 10k times commit in one second
(1...100000).to_a.each{`git commit --allow-empty -m "commit"`}