Skip to content

Instantly share code, notes, and snippets.

許益銘 rc1021

Block or report user

Report or block rc1021

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 01.readme.md

Querying JSON with SelectToken and Linq Descendants

使用 Newtonsoft 的 SelectToken 取得 Path 節點的內容值,以及 Descendants 拜訪節點

以下的範例我們將使用這個 Json 結構進行說明

JObject o = JObject.Parse(@"{
  'Stores': [
    'Lambton Quay',
    'Willis Street'
View 01.queryStringToJson.js
function queryStringToJson(s="")
{
return JSON.parse(s.replace(/[?|&]([A-Za-z0-9]*)=([^&]*)/ig, ",\"$1\":\"$2\"").slice(1).replace(/(.*)/, "{ $1 }"));
}
View MOBILE_DETECT_FUNCTION.js
/*----------------------------------------------------*/
/* MOBILE DETECT FUNCTION
/*----------------------------------------------------*/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
@rc1021
rc1021 / ParsedUrl.js
Last active Apr 3, 2018 — forked from acdcjunior/ParsedUrl.js
Cross-browser URL parsing in JavaScript
View ParsedUrl.js
function ParsedUrl(url) {
this.parse(url);
}
ParsedUrl.prototype.parse = function (url) {
var parser = document.createElement("a");
parser.href = url;
// IE 8 and 9 dont load the attributes "protocol" and "host" in case the source URL
// is just a pathname, that is, "/example" and not "http://domain.com/example".
@rc1021
rc1021 / webpack.config.js
Created Feb 2, 2018 — forked from JesterXL/webpack.config.js
Example webpack for ES6 unit testing
View webpack.config.js
'use strict';
// Modules
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var _ = require('lodash');
@rc1021
rc1021 / main.html
Last active Dec 24, 2017
demo serializeArray of form to json object
View main.html
<!DOCTYPE html>
<html>
<head>
<title>demo serializeArray of form to json object</title>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<form>
<input type="text" name="desc" value="demo serializeArray of form to json object.">
<input type="text" name="users[0].name" value="user A">
View lodash_array_to_object.js
let _ = require('lodash');
//Input
var input = [
{ key: '1', val: 'a' },
{ key: '2', val: 'b' },
{ key: '3', val: 'c' }
];
//Desired output
@rc1021
rc1021 / jquery-scroll-bottom.js
Last active Aug 8, 2018
指定 selector 如果有捲軸時,當滑動至底部時觸發事件
View jquery-scroll-bottom.js
/**
* @description jQuery-scroll-bottom。
*
* 指定 selector 如果有捲軸時,當滑動至底部時觸發事件
* @module ScrollBottom
* @author 許益銘 <mufasa.hsu@gmail.com>
* @example
* require('./jquery-scroll-bottom');
*
* // method 1
@rc1021
rc1021 / PasswordEntryCell.cs
Last active Apr 14, 2017
加入PasswordEntryCell,讓 Xamarin 具有密碼輸入的 EntryCell
View PasswordEntryCell.cs
/**
* 這檔案是參考 https://forums.xamarin.com/discussion/21298/entrycell-password 並加以修正。
* 主要是 xamarin 目前暫無密碼輸入的 EntryCell,
*
* 我增加的部份:
* 1. 建立 BindableProperty 讓 XAML 也可以使用 Value 屬性 | 2017.04
*/
using System;
using Xamarin.Forms;
@rc1021
rc1021 / AutoArrangement.xaml
Created Mar 29, 2017
Custom layouts with Xamarin.Forms: auto arrangement cells (not finish)
View AutoArrangement.xaml
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App1"
x:Class="App1.AutoArrangement"
Title="Auto-Arrangement">
<ContentPage.Content>
<local:GridListView
You can’t perform that action at this time.