Skip to content

Instantly share code, notes, and snippets.

View wagurano's full-sized avatar
🍈

dallos wagurano

🍈
View GitHub Profile
@wagurano
wagurano / hir.getinfo.rb
Created December 10, 2013 02:17
건강보험심사평가원 병원 위치 등 일반현황 가져오기
#encoding: utf-8
require 'net/http'
require 'nokogiri'
require 'open-uri'
require 'timeout'
TIMEOUT_CNT = 42
def print_info code
retries = TIMEOUT_CNT
@wagurano
wagurano / animal.getinfo.rb
Last active January 4, 2016 14:28
대한수의사회( http://www.kvma.or.kr )에서 병원목록를 가져옵니다.
#encoding: utf-8
require 'net/http'
require 'nokogiri'
require 'open-uri'
require 'timeout'
TIMEOUT_CNT = 42
def print_header
puts 'no,name,address,contact,doctor'
class Place
include Mongoid::Document
include Mongoid::Timestamps
include Geocoder::Model::Mongoid
field :type
field :category
field :category_desc
field :name
field :description
@wagurano
wagurano / getpharm.egen.rb
Last active September 25, 2015 13:21
당번약국을 보여주고 당번인데 문닫은 약국을 신고합니다. 구글드라이브 [CSV파일](https://drive.google.com/file/d/0B8WezMmea38UVjlxc3FHR3V1Q28/view?usp=sharing) 2014년 10월 기준, 심사평가원 + 중앙응급의료원 대한약사회에서 휴일지킴이약국을 http://www.pharm114.or.kr/ 운영합니다. 여기서는 중앙응급의료원 http://www.e-gen.or.kr/ 에서 자료를 가져옵니다. 공공데이타포털에서도 자료를 가져올 수 있는데 하루 1000 회 제한이 있습니다. 심사평가원의 데이타를 추정해보면 약 20만 여개로 추정하는데 공공API로는 수일내…
#encoding: utf-8
require 'net/http'
require 'nokogiri'
require 'open-uri'
require 'timeout'
require 'json'
TIMEOUT_CNT = 42
def egen_print_pharm_info code
@wagurano
wagurano / add_star_to_name.rb
Created February 12, 2015 09:45
가게이름 일부 가리는 방법
name = [
"상회",
"분당상가",
"백화점",
"NC백화점"
]
print "name = "
p name
@wagurano
wagurano / 1thingbar.js
Last active August 29, 2015 14:17
1thing.kr 배너 담기
var OneThingBar=function() {
// 1thing.kr - Let's start with one thing.
var styl = document.createElement('style')
styl.innerHTML = "div#notification-banner { background: rgba(255, 51, 0, 1); border-radius: 0 0 6px 6px; color: rgba(255, 255, 255, 1); cursor: pointer; font-weight: bold; font-family: Open Sans; left: 0%; line-height: 25px; margin-left: 0px; position: fixed; text-align: center; top: 0; width: 100%; } div#notification-banner span { padding: 3px 10px; }"
document.body.appendChild(styl)
var banner = document.createElement("div")
banner.id = "notification-banner"
banner.onclick = (function () { return function() {this.style.display='none'} })()
banner.title="누르면 사라집니다.(click to hide)"
banner.innerHTML = '뭐라도 해야겠는데 그저 막막하신가요? 작은 것 하나를 <a href="http://1thing.kr/" target=_blank>시작</a>해봐요.'
require 'minitest/autorun'
begin
require_relative 'hamming'
rescue LoadError => e
puts "\n\n#{e.backtrace.first} #{e.message}"
puts DATA.read
exit 1
end
class HammingTest < Minitest::Test
@wagurano
wagurano / jpgmv.rb
Created August 29, 2015 05:50
Move all of contents files to images directory
require 'FileUtils'
Dir["contents/**/*"].select{ |f| File.file? f }.map{ |f| FileUtils.move "#{f}", "images/#{File.basename f}.jpg" }
@wagurano
wagurano / general-index.html.erb
Last active November 3, 2015 10:59
form-example
<h1>Test</h1>
<%= form_tag { 'basic form tag' } %>
<%= form_tag('/posts') { 'form posts'} %>
<%= form_tag('/posts/1', method: :put) { 'form posts/1'} %>
<%= form_tag('/upload', multipart: true) { 'form upload' } %>
<%= form_tag('/posts') do -%>
<div><%= submit_tag 'Save' %></div>
<% end -%>
<%= form_tag('/posts', remote: true) { 'remote' } %>
<%= form_tag('http://far.away.com/form', authenticity_token: false) { 'token false' } %>
@wagurano
wagurano / how-to-netsted-form.md
Last active November 15, 2015 15:10
Nested form rails

입력 폼 중첩

설문조사 사례로 살펴보는 모델 관계에 따라 중첩하는 입력 폼

준비

설문조사 서식으로 입력폼을 만듭니다.

rails new surveyform