Skip to content

Instantly share code, notes, and snippets.

View tedshd's full-sized avatar

Ted tedshd

View GitHub Profile
@tedshd
tedshd / JSNOP.js
Last active September 12, 2016 15:29
Async
function componentHTML(width, height, id, dom, count) {
if (!dom) {
console.error('not set dom');
return;
}
if (!count) {
var count = '';
}
var js = document.createElement('script');
js.setAttribute('id', 'component_' + id + '_' + count);
@tedshd
tedshd / zsh.md
Created September 29, 2015 09:16 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@tedshd
tedshd / onbeforeunload.html
Created September 9, 2015 09:39
onbeforeunload demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Examples</title>
<link href="" rel="stylesheet">
</head>
<body>
<a href="https://www.google.com.tw/?gfe_rd=cr&ei=6evvVeztB4rT8AWBzL-ABw">A</a>
@tedshd
tedshd / ModernWeb_2015.md
Created August 7, 2015 02:22
ModernWeb 2015 log

1996 ajax

asm.js bytecode

ES6 寫法向 Java 靠攏

ES7 草案中

@tedshd
tedshd / Hestia_Google_search
Last active August 29, 2015 14:20
Hestia Google search
@tedshd
tedshd / trim
Last active August 29, 2015 14:19
Trim html
function trimHTMLTagContent(string) {
string = string.replace(/\n/g, '');
string = string.replace(/\s\s/g, '');
// remove two space
string = string.replace(/<font color.*?<\/font>/mig, '');
// remove color font content
string = string.replace(/<[^>]*>/g, '');
// remove html tag
console.log(string);
}
@tedshd
tedshd / polling.js
Last active August 29, 2015 14:17
polling with jquery
var polling,
pollingResponse = true;
polling = setInterval(
function () {
if (pollingResponse) {
console.log('polling');
pollingResponse = false;
$.ajax({
url: 'test.php',
type: 'POST',
@tedshd
tedshd / 0_reuse_code.js
Last active August 29, 2015 14:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tedshd
tedshd / ajax.js
Last active August 29, 2015 14:13
Ajax method with javascript
/*global $, jQuery, alert, console, angular*/
/**
*
* @authors Ted Shiu ([email protected])
* @date 2015-01-09 01:23:09
* @version $Id$
*/
/**
* [Ajax basic]