Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
simenbrekken / .htaccess
Created August 27, 2012 18:53
Apache mod_rewrite cookie based localization
RewriteEngine On
# Set locale cookie if lang query string is set (90 days expiry time)
RewriteCond %{QUERY_STRING} lang=(.*)
RewriteRule .* ?locale=%1 [cookie=locale:%1:.%{HTTP_HOST}:129600:/]
# Append locale to query string if:
# - Query string hasn't already been rewritten
# - Locale cookie is set
# - Request URI isn't a valid file (for assets etc.)
Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first
which breaks when you're using CommonJS with webpack.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-bs (bootstrap)
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd
Create a loader "exception" just for DT in webpack.config.js:
module: {
loaders: [
@sanhuang
sanhuang / README.md
Created November 29, 2016 07:25
繁簡體中文日文韓文的Unicode字元範圍

** 匹配Unicode字符的正則表達式

這裡是幾個主要非英文語系字符範圍(google上找到的):

  • 2E80~33FFh:中日韓符號區。收容康熙字典部首、中日韓輔助部首、注音符號、日本假名、韓文音符,中日韓的符號、標點、帶圈或帶括符文數字、月份,以及日本的假名組合、單位、年號、月份、日期、時間等。
  • 3400~4DFFh:中日韓認同表意文字擴充A區,總計收容6,582個中日韓漢字。
  • 4E00~9FFFh:中日韓認同表意文字區,總計收容20,902個中日韓漢字。
  • A000~A4FFh:彝族文字區,收容中國南方彝族文字和字根。
  • AC00~D7FFh:韓文拼音組合字區,收容以韓文音符拼成的文字。
  • F900~FAFFh:中日韓兼容表意文字區,總計收容302個中日韓漢字。
  • FB00~FFFDh:文字表現形式區,收容組合拉丁文字、希伯來文、阿拉伯文、中日韓直式標點、小符號、半角符號、全角符號等。
@Tito0269
Tito0269 / Codigo.gs
Last active December 13, 2023 16:03
Crud Google Apps Scripts
function doGet(e){
Logger.log(e);
var op = e.parameter.action;
var ss=SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1UUBGKGvm4b9LOhqbdh0UDG6vYz9Phr1DqGyg8DvCiUc/edit?usp=sharing");
var sheet = ss.getSheetByName("Sheet1");
if(op=="insert")
return insert_value(e,sheet);