Skip to content

Instantly share code, notes, and snippets.

I'm back

Jayson LP Chen eit

I'm back
View GitHub Profile
View objective c xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View mobile_device_check.html
if ((navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/Android/i)) ||
(navigator.userAgent.match(/Windows Phone OS 7/i)))
View intersection.sql
SELECT user_id
FROM `facebook_active_user_201303`
WHERE page_id = '145649977189'
AND startdate = '2013-03-01'
AND period = 'month'
AND user_id
SELECT user_id
FROM `facebook_active_user_201303`
View gps based recommendation list.json
"array": [
"location": {
"lat": 123,
"long": 456,
"address": "xxxxxx"
"uid": "12345"
"tel": "0912345678",
View download_file_name_set
context.Response.ContentType = _contentType;
//檔案Response出去 註:這邊會將檔案整個Response出去但是並不會顯示路徑!!
context.Response.WriteFile(ConfigurationManager.AppSettings["files_folder_PhysicalPath"] + _file);
string _fileName = HttpUtility.UrlPathEncode( Path.GetFileName(_file));
string strContentDisposition = String.Format("{0}; filename=\"{1}\"", "inline", _fileName);
context.Response.AddHeader("Content-Disposition", strContentDisposition);
View isUTF8.php
private function isUTF8($word)
if (preg_match("/^([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}$/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){2,}/",$word) == true)
return true;
return false;
View sublime_setting.json
"bold_folder_labels": true,
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"disabled_single_snippet_for_scopes": "text.html, er, pe, pc, if, ife, else, elsif, end, lt",
"ensure_newline_at_eof_on_save": true,
View nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/;
eit /
Last active Aug 29, 2015
Install elastic search on Ubuntu 14.04
cd ~
### Install default-jre
sudo apt-get update
sudo apt-get install default-jre
### Check for latest version of ElasticSearch and replace wget link below
sudo dpkg -i elasticsearch-1.7.1.deb
# size of swapfile in megabytes
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then