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
var languagesMap = map[string]string{ | |
"aar": "aa", | |
"abk": "ab", | |
"ace": "xx", | |
"ach": "xx", | |
"ada": "xx", | |
"ady": "xx", | |
"afa": "xx", | |
"afh": "xx", | |
"afr": "af", |
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
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x7000000e1}, {"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}' | |
# remap §(top left corner) to be ` | |
# remap `(very weirdly positioned near left shift) to be left shift | |
# from http://www.usb.org/developers/hidpage/Hut1_12v2.pdf | |
# § - id 0x64 | |
# left shift - id 0xe1 | |
# ` - id 0x35 |
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
// took the list from: | |
// http://www.phacks.net/detecting-search-engine-bot-and-web-spiders/ | |
// and made it a map[string]bool | |
var BOTS = map[string]bool{ | |
"Baiduspider+(+http://www.baidu.com/search/spider.htm": true, | |
"Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)": true, | |
"Moreoverbot/5.1 (+http://w.moreover.com; [email protected]) Mozilla/5.0": true, | |
"UnwindFetchor/1.0 (+http://www.gnip.com/)": true, | |
"Voyager/1.0": true, |
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
# inspired by https://github.com/biilmann/mongo_sessions | |
require 'rack/session/abstract/id' | |
class Session | |
include Mongoid::Document | |
field :sid | |
field :data | |
field :ts, type: Integer | |
index :sid, unique: true #dont forget Session.create_indexes | |
def Session.find_by_sid(sid) | |
Session.first(conditions: {sid: sid}) |