This file contains 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
class TaiwaneseAddress | |
def initialize(address) | |
@original_address = address.clone() | |
@levels = prepare_level() | |
@levels.each do |level| | |
level.keys.each do |region| | |
if match = address[/^(.{1,4}#{region})/,1] | |
level[region] = match |
This file contains 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 rspecgrep() | |
{ | |
SPK_FILES=`find spec -type f -name "*_spec.rb" | grep $1` | |
echo $SPK_FILES | |
time rspec $SPK_FILES --format documentation | |
} |
This file contains 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
<xsl:stylesheet version="1.0" | |
xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
> | |
<!-- lulalala 2008/10/16 created --> | |
<xsl:output method="text" encoding="UTF-8"/> |
This file contains 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
if (document.cookie.indexOf("full_site=1") === -1 && navigator.userAgent.match(/iPhone|iPod|iPad|Android/i)) { | |
window.location = document.URL.replace(/:\/\//, '://m.'); | |
} |
This file contains 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
# | |
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do | |
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute) | |
# and ensure they are the only ones to get validated. | |
# | |
module ConditionalValidations | |
attr_accessor :validated_fields | |
def field_is_required?(field) |
This file contains 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
require 'open-uri' | |
class Nokogiri::HTML::Document | |
# Use open-uri to get document and set url accordingly. | |
def self.get(url) | |
raw = open(url) | |
parse(raw, raw.base_uri.try(:to_s)) # handles redirected url | |
end | |
end | |
module Nokogiri::HTML | |
def self.get(url) |
This file contains 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
{"categories"=>{"count"=>"0"}} | |
{"categories"=>{"category"=>{"no"=>"76044", "level_no"=>"4", "name"=>"NANING9", "type"=>"區"}, "count"=>"1"}} | |
{"categories"=>{"category"=>[{"no"=>"17746", "level_no"=>"4", "name"=>"Fashion Focus", "type"=>"區"}, {"no"=>"14482", "level_no"=>"4", "name"=>"MM25下身系列", "type"=>"區"}], "count"=>"2"}} |
This file contains 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
Hey, fellow hackers! | |
This week we are bringing "Custom Theme" to you ! | |
1. Starting today, we now support custom themes. You can customize your own template by going to Theme's setting : | |
http://logdown.com/account/blogs/lulalala/themes | |
* See announcement here: New Feature: Custom Theme |
This file contains 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
最北 西引島北固礁 | |
26.38306, 120.47611 | |
最南 七星岩 | |
21.758883, 120.824706 | |
最東 赤尾嶼 | |
25.921667, 124.558333 | |
最西 金門縣烈嶼鄉 |