Skip to content

Instantly share code, notes, and snippets.

View marsen's full-sized avatar
🕯️
Freedom

Marsen marsen

🕯️
Freedom
View GitHub Profile
function showInfo(Obj)
{
for (var k in Obj) {
if (Obj.hasOwnProperty(k)) {
console.log("Obj." + k + ":" + Obj[k]);
}
}
}
//how to use it ?
//1. You need jQuery
//2. finish the code about GetData GetTemplate GenSomething
//3. Call the Run() like the following
var obj = new myObject();
obj.Run();
//
function myObject() {
var template,
data = {
@marsen
marsen / ASPdotNet.txt
Last active August 29, 2015 14:04
.NET Web 隨筆
1.web.config & Settings.cs 化
2.attribute產生log & web log
3.javascript minify nonchache & json parse
@marsen
marsen / Module.html
Last active August 29, 2015 14:04
About javascript Module Pattern Sample
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
//#region
var MyModule = {};
@marsen
marsen / placeholder.html
Created August 6, 2014 06:00
placeholder html
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<style>
input:focus::-webkit-input-placeholder { color:transparent; }
input:focus:-ms-input-placeholder { color:transparent; }
input:focus::-moz-placeholder { color:transparent; } /* FF 4-18 */
input:focus:-moz-placeholder { color:transparent; } /* FF 19+ */
</style>
@marsen
marsen / getQueryValue.js
Created September 16, 2014 01:32
getQueryValue
function getQueryValue(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@marsen
marsen / Marsen.js
Last active August 29, 2015 14:06
Marsen Sandbox
//學習沙盒模式(Sandbox pattern)的範例
//順便整合一些之前常用的code,ex: 取亂數、取cookie等…
Marsen.modules = {} ;
Marsen.modules.web = function(box){
box.getQueryValue = function (name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
};//query string 取值
@marsen
marsen / DateFormat.js
Created October 16, 2014 03:21
DateFormat.js
//擴充Date基本方法
Date.prototype.format = function (fmt) {
var opt = {
"M+": this.getMonth() + 1, //月
"d+": this.getDate(), //日
"h+": this.getHours(), //時
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季
"S": this.getMilliseconds() //毫秒
@marsen
marsen / sample.js
Last active August 29, 2015 14:20
CSharp Ticks to javascirpt time
//CSharp
new Date((cSharp.Ticks/10000) - 62135625600000),
@marsen
marsen / markTest.js
Created September 6, 2015 05:18
facebookQA
$(document).ready(function(){
$("#content").hide();
$("#content").fadeIn(2000);
$(".nav").hide();
$(window).scroll(function(){
if($(document).scrollTop()<7){