Skip to content

Instantly share code, notes, and snippets.

@choipd
choipd / Gemfile
Created October 5, 2012 00:03
행안부의 착한가격업소 crawling 소스와 GoodShop model, 그리고 리버스 지오코딩 적용한 것
gem 'httparty'
gem 'nokogiri'
gem 'mongoid', '~> 3.0.0'
gem 'geocoder'
gem 'mongoid_geospatial'
@choipd
choipd / crawling.rake
Created October 5, 2012 16:49
Nokogiri 사용법
uri = "http://www.mulga.go.kr/price/bestStore/regionInfo.do?bestStoreSeq=#{n}"
doc = Nokogiri::HTML(open(uri))
data = GoodShop.new
data.crawl_no = n
data.title = doc.xpath("//div[attribute::id='content']/h4").text
data.address = doc.xpath("//th[text()='주소']/following-sibling::*").text
data.phone = doc.xpath("//th[text()='전화번호']/following-sibling::*").text
data.business_type = doc.xpath("//th[text()='업종']/following-sibling::*").text
a = doc.xpath("//th[text()='주요품목']/following-sibling::*").collect { |a| a.text }
h = Hash[*a]
@choipd
choipd / crawling.rake
Created October 5, 2012 17:14
call_geocoding 구현
api_key = "당신의 다음 Open API 키"
def call_geocoding(address)
begin
uri = "http://apis.daum.net/local/geo/addr2coord?apikey=#{api_key}&output=xml&q=#{URI::encode(address)}"
doc = Nokogiri::XML(open(uri))
rescue OpenURI::HTTPError => the_error
the_status = the_error.io.status[0]
puts "[#{the_status}]"
else
if doc.xpath("//lng[1]").text == "" then
@choipd
choipd / app.xml
Created November 19, 2012 13:31
Titanium에서 한글 앱 이름 설정하기
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="appname">안심이</string>
</resources>
@choipd
choipd / AndroidManifest.xml
Created November 19, 2012 13:34
Titanium에서 한글 앱 이름 설정하기
<application android:icon="@drawable/appicon"
android:label="@string/app_name" android:name="AnsimApplication"
android:debuggable="false">
<!-- TI_APPLICATION -->
<activity android:name=".AnsimActivity"
android:label="@string/app_name" android:theme="@style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
@choipd
choipd / strings.xml
Created November 19, 2012 13:36
Titanium에서 한글 앱 이름 설정하기
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="home">홈</string>
<string name="settings">설정</string>
<string name="openWindow">새 창 열기</string>
<string name="newWindow">새 창</string>
<string name="app_name">안심이</string>
</resources>
@choipd
choipd / NewAlbumPage.xaml
Created March 4, 2015 17:04
NulReferenceException on XLabs.Forms.Controls.CheckBoxRenderer.OnElementChanged
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="PixbeeProto.NewAlbumPage"
Title="Create Album"
Padding="10, 40, 10, 10"
xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms">
<StackLayout>
<Label Text="Create a new album!"
@choipd
choipd / ko.json
Last active June 10, 2017 05:54
Korean Translatation for openweathermap api response code http://openweathermap.org/weather-conditions
"openweathermap": {
"weather_code": {
"200": "가벼운 비를 동반한 천둥구름",
"201": "비를 동반한 천둥구름",
"202": "폭우를 동반한 천둥구름",
"210": "약한 천둥구름",
"211": "천둥구름",
"212": "강한 천둥구름",
"221": "불규칙적 천둥구름",
"230": "약한 연무를 동반한 천둥구름",
@choipd
choipd / openweathermap_api_translation_ko
Created February 13, 2016 06:07
OpenWeatherMap api의 다국어에 한국어 지원을 위한 협업용 파일
Parameter English Your language
200 thunderstorm with light rain 가벼운 비를 동반한 천둥구름
201 thunderstorm with rain 비를 동반한 천둥구름
202 thunderstorm with heavy rain 폭우를 동반한 천둥구름
210 light thunderstorm 약한 천둥구름
211 thunderstorm 천둥구름
212 heavy thunderstorm 강한 천둥구름
221 ragged thunderstorm 불규칙적 천둥구름
230 thunderstorm with light drizzle 약한 연무를 동반한 천둥구름
231 thunderstorm with drizzle 연무를 동반한 천둥구름
@choipd
choipd / app.module.js
Created March 15, 2016 16:13
Fixed for supporting Spanish in iOS/Android Language setting
$translateProvider.registerAvailableLanguageKeys(['en', 'es', 'cn', 'ko', 'jp'], {
'en-CA': 'en',
'en-US': 'en',
'en-UK': 'en',
'ko-KR': 'ko',
'ko': 'ko',
'zh': 'cn',
'zh-hk': 'cn',
'zh-sg': 'cn',
'zh-CN': 'cn',