Skip to content

Instantly share code, notes, and snippets.

@zeknas
zeknas / gist:b702dd7270e8ed4e4faa3b1a03c7c42b
Last active Aug 23, 2017 — forked from perusio/gist:1326701
[Mobile device detection in Nginx] with just 7 lines of configuration #nginx
View gist:b702dd7270e8ed4e4faa3b1a03c7c42b
### 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
View 0-Simple counter: different implementations...
different implementations of the simple counter app... code verbosity vs expressiveness
@zeknas
zeknas / .babelrc
Last active Feb 15, 2017
hyperapp + jsx + webpack minimal boilerplate #tags: hyperapp
View .babelrc
{
"presets": ["es2015"],
"plugins": [
[
"transform-react-jsx",
{
"pragma": "h"
}
]
]
@zeknas
zeknas / index.html
Last active Feb 15, 2017
hyperapp + jsx + rollup minimal boilerplate #tags: hyperapp
View index.html
<!doctype html>
<html>
<body>
<script src="bundle.js"></script>
</body>
</html>
@zeknas
zeknas / .babelrc
Last active Feb 15, 2017
hyperapp + jsx + browserify minimal boilerplate #tags: hyperapp
View .babelrc
{
"presets": ["es2015"],
"plugins": [
[
"transform-react-jsx",
{
"pragma": "h"
}
]
]