Skip to content

Instantly share code, notes, and snippets.

View marsen's full-sized avatar
🕯️
Freedom

Marsen marsen

🕯️
Freedom
View GitHub Profile
@marsen
marsen / .On vs .Live in JQuery
Last active December 29, 2015 12:19
.On vs .Live in JQuery,Attach an event, now and in the future. Using jquery-1.8.3.min.js
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script>
$(function(){
$('#wrapper').on('click','#onlink',function(event){
alert('on link was clicked');
});
$("#livelink").live('click',function(){
alert('live link was clicked');
@marsen
marsen / 自動產生亂數序號
Last active December 23, 2015 23:49
Auto Gen Random Keys by MSSQL
DECLARE @start INT = 1;
DECLARE @end INT = 50;
WITH #KEYS AS (
SELECT @start AS Number, REPLACE(LEFT(NEWID(), 18), '-', '') AS [KEY]
UNION ALL
SELECT Number + 1, REPLACE(LEFT(NEWID(), 18), '-', '') AS [KEY]
FROM #KEYS
WHERE Number < @end
)
SELECT * FROM #KEYS OPTION (MAXRECURSION 0)
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(function(){
$('#app-opener').bind('click',
function(){
var timer = setTimeout(function(){
alert('you not installed the x-myapp!!');
},1000);