Skip to content

Instantly share code, notes, and snippets.

View casunlight's full-sized avatar

Vivian Zhang casunlight

View GitHub Profile
code: R
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src='http://ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
@casunlight
casunlight / index.html
Created May 9, 2014 00:25
Hair Color vs. Eye Color
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/assets/css/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script>
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: steelblue;
}
.bar:hover {
fill: brown;
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: steelblue;
}
.bar:hover {
fill: brown;
@casunlight
casunlight / install_nodejs
Created March 26, 2014 20:53
install nodejs by apt-get
~ sudo apt-get install nodejs
~ sudo apt-get install npm
~ node -v
v0.6.12
~ npm -v
1.1.4
@casunlight
casunlight / server.R
Created March 25, 2014 21:07
vivian_shiny_intro_meetup_case_study
# this solution is contributed by Jay Grossman who attended that intro session! Good job, Jay!
# I asked everyone to creat a app which could upload csv data and build linear regression model
shinyServer(function(input, output) {
#output$contents <- renderTable({
# input$file1 will be NULL initially. After the user selects and uploads a
# file, it will be a data frame with 'name', 'size', 'type', and 'datapath'
# columns. The 'datapath' column will contain the local filenames where the
# data can be found.
@casunlight
casunlight / ImgSVD.r
Last active August 29, 2015 13:57
SVD and Image Compression(by Shiny! Yes!) http://blog.supstat.com/2014/03/svd-and-image-compression/
library(rARPACK);
library(jpeg);
factorize = function(m, k){
r = svds(m[, , 1], k);
g = svds(m[, , 2], k);
b = svds(m[, , 3], k);
return(list(r = r, g = g, b = b));
}