Skip to content

Instantly share code, notes, and snippets.

View SFantasy's full-sized avatar
🌝
ENJOY~

Fantasy SFantasy

🌝
ENJOY~
View GitHub Profile
$.ajax {
url: '',
xhrFields: {
// option for cross domain
withCredentials: true
},
success: function(data) {
//
}
}
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="first AngularJS application" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div ng-controller='TestController'>
@SFantasy
SFantasy / index.html
Created October 28, 2013 05:58
HTML template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="keywords" content="type your keywords here" />
<meta name="description" content="type your description here" />
<meta id="viewport" name="viewport"
content="widht=device-width, user-scalable=yes, initial-scale=0.5" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
@SFantasy
SFantasy / ajax.js
Last active December 22, 2015 00:19
Simple Ajax wrapped.
var Ajax = {
/**
* ajax 封装
* @param options {
* type: GET || POST
* datatype: JSON as default
* url: Interface URL
* sdata:
* callback: Callback function
* async: true || false
@SFantasy
SFantasy / animation-rotate.html
Created August 1, 2013 09:33
CSS animation example
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.row > a#transform {
text-decoration: none;
width: 40px;
height: 40px;
display: inline-block;
/* Template part from twitter.github.io/bootstrap
*
*/
body {
color: #777;
background-color: #f1f1f1;
font-family: "Microsoft YaHei", Georgia, 黑体, Helvetica, Arial, sans-serif;
padding-top: 20px;
}
@SFantasy
SFantasy / getTime.html
Created May 25, 2013 17:52
JavaScript实时获取时间
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Clock</title>
<script>
var i;
function getTime () {
var date = new Date();
var year = date.getFullYear();
@SFantasy
SFantasy / jsonexample.json
Created May 25, 2013 17:23
JSON syntax example.
{
"name": "Medivh",
"age": 18,
"location": "Azeroth",
"hobby": [ "eating","sleeping" ],
"friends": [
{
"name": "Lothar",
"age": 21,
"profession": "solider"
@SFantasy
SFantasy / getClass.js
Last active December 17, 2015 00:29
My implementation of `getElementsByClass()`
function getClass(c) {
var l = document.getElementsByTagName('*');
var x = new Array();
for(var i = 0; i < l.length; i++) {
if(l[i].classList !== undefined && l[i].classList.contains(c)) {
x.push(l[i]);
}
}
@SFantasy
SFantasy / mergeFile.py
Created December 26, 2012 13:37
合并两个文件,如:将test1.txt中的所有行添加到test2.txt的每个行的最末尾。
#/usr/bin/python
#Filename: mergeFile.py
#Usage: merge all the lines in test1 and test2
file1 = open('test1.txt', 'r')
file2 = open('test2.txt', 'r')
lines1 = file1.readlines()
lines2 = file2.readlines()