Skip to content

Instantly share code, notes, and snippets.

View fraserxu's full-sized avatar
🐢
No idea

Fraser Xu fraserxu

🐢
No idea
View GitHub Profile
@fraserxu
fraserxu / auth.js
Last active February 6, 2018 09:51
Handling CORS in Meteor app
/*
* packages/reststop2/auth.js
* Add a method to handle OPTIONS request
*/
// return nothing
RESTstop.add('login', {'method': 'OPTIONS'}, function() {})
@fraserxu
fraserxu / index.jade
Last active August 29, 2015 14:01
async load google map api demo
doctype html
html(lang="en")
head
title Map App
body(ng-app="mapApp" animation="slide-left-right-ios7")
ion-nav-bar.bar-light.shadow
ion-nav-view(id="main")
//- use init-map directive here
@fraserxu
fraserxu / isInArea.coffee
Created July 1, 2014 08:42
A function to calculate if a geo point is in a cirlce
###*
* Check if a given point in a circle
* @param {Object} circle a cirle object with radius and center point
* @param {Object} point a point need to be checked
* @return {Boolean} True or False
###
Map.isInArea = (circle, point) ->
getDistance = (lng1, lat1, lng2, lat2) ->
# Radisu of the erath in km
R = 6371
@fraserxu
fraserxu / loadMore.js
Last active August 9, 2023 05:37
Simple load more function for ng-repeat with limitTo filter
// set the default amount of items being displayed
$scope.limit= 5;
// loadMore function
$scope.loadMore = function() {
$scope.limit = $scope.items.length
}
@fraserxu
fraserxu / index.js
Last active August 29, 2015 14:06
requirebin sketch
var React = require('react')
var jsonp = require('jsonp')
var APP = React.createClass({
getInitialState: function() {
return {
user: {}
}
},
@fraserxu
fraserxu / index.html
Created November 20, 2014 08:30
Hello World
<html>
<body>
Hello World!
</body>
</html>
@fraserxu
fraserxu / index.html
Created December 8, 2014 07:56
Embedding test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSViz embedding test</title>
</head>
<body>
<h4>CSViz embedding test</h4>
<iframe width="400" height="800" frameborder="0" scrolling="y" marginheight="0" marginwidth="0" src="http://csviz.github.io/csviz"></iframe>
</body>
@fraserxu
fraserxu / README.md
Last active August 29, 2015 14:11 — forked from mbostock/.block

This variation of a line chart demonstrates how to use a linear gradient to change the color of a line based on a y-threshold. This technique is similar to the gradient encoding, but with two stops at the same offset. An alternative method is to draw multiple lines with different colors and different clipping regions.

@fraserxu
fraserxu / china_provinces.json
Created December 18, 2014 06:35
china population choropleth
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fraserxu
fraserxu / china_provinces.json
Created December 18, 2014 06:38
china population stack barchart
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.