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
# from https://github.com/ruby-china/ruby-china/blob/master/app/helpers/application_helper.rb | |
MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' + | |
'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' + | |
'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + | |
'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + | |
'webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|mobile' | |
def mobile? | |
agent_str = request.user_agent.to_s.downcase | |
return false if agent_str =~ /ipad/ |
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
# Model | |
expect(@user).to have(1).error_on(:username) # checks whether there is an error in username | |
expect(@user.errors[:username]).to include("can't be blank") # check for the error message | |
# Rendering | |
expect(response).to render_template(:index) | |
# Redirecting |
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
SDCC = sdcc | |
STM8FLASH = stm8flash | |
CHIP = STM8S003 | |
CHIP_LCASE = $(shell echo $(CHIP) | tr '[:upper:]' '[:lower:]') | |
CFLAGS = -lstm8 -mstm8 -L./libsrc/build/ -lstm8s_periph.lib -I./libsrc/inc -D$(CHIP) -DUSE_STDPERIPH_DRIVER | |
MAIN_SOURCE = launcher |
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
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |