Skip to content

Instantly share code, notes, and snippets.

View wuzhonglin's full-sized avatar

wuzhonglin

  • tokyo
View GitHub Profile
@wuzhonglin
wuzhonglin / gist:47d5214314a8e39e3e518418d5531549
Created October 25, 2020 15:42 — forked from siliconsocket/gist:ae72ad29b3ef8430efc229d1a7a42862
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@wuzhonglin
wuzhonglin / apache_log_ruby.rb
Last active September 3, 2015 08:57 — forked from hiroyuki-sato/apache_log_ruby.rb
Apache Log Parser Plugin
require 'apache_log/parser'
module Embulk
module Parser
class Apache_log_rubyParserPlugin < ParserPlugin
Plugin.register_parser("apache_log_ruby", self)
STRING_FIELDS = %w[ remote_host identity_check user status size ].map{|x| x.to_sym }
REQUEST_FIELDS = %w[ method path protocol ].map{ |x| x.to_sym }
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09 for most of these projects, and the "last update" field has not been kept up to date since then.
Active projects:
---------------
ComfortableMexicanSofa
repo: https://github.com/comfy/comfortable-mexican-sofa
Last update: 10/08/13
"ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails applications"