Skip to content

Instantly share code, notes, and snippets.

View VioletVivirand's full-sized avatar
👻
Always searching for the next job 😜

Chung-Ping Huang VioletVivirand

👻
Always searching for the next job 😜
  • Chunghwa Telecom
  • Kaohsiung, Taiwan
  • 15:20 (UTC +08:00)
View GitHub Profile
@VioletVivirand
VioletVivirand / README.md
Created June 16, 2017 00:57
Use ronnywang/pdf-table-extractor CLI to extract CSV files

Prerequisities

  1. Install npm
  2. install gulp with npm install gulp-cli -g

Step by step

$ git clone https://github.com/ronnywang/pdf-table-extractor
$ git clone https://github.com/mozilla/pdf.js
@VioletVivirand
VioletVivirand / iterate.js
Created April 28, 2017 07:51
Iterate Data
#.getJSON("http://example.com/data.json", function(data) {
table_data = []
for each(item in data) {
row = { node: item.node, value: item.value }
table_data.push(row)
}
somefunction();#
('#realtime_table').bootstrapTable({
data: table_data
})
@VioletVivirand
VioletVivirand / marshal_with_demo.py
Created April 25, 2017 08:48
Flask marshal_with Demo
from flask import Flask, make_response
from flask_restful import Resource, Api, fields, marshal_with
import pandas as pd
# 初始化
app = Flask(__name__)
api = Api(app)
todo_fields = {
"col_one": fields.String(attribute="col1"),
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<!-- Additional files for the Highslide popup effect -->
<script src="https://www.highcharts.com/media/com_demo/js/highslide-full.min.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script>
$.getJSON('https://gist.githubusercontent.com/VioletVivirand/74cb28602595c2a18d8c9de77ebabe78/raw/a8a4567d9f1399ca206add3dd25826e2e0759b23/timedata.json', function(data) {
@VioletVivirand
VioletVivirand / parse_string_to_ms.py
Created April 25, 2017 00:32
Parse from String Series to Timestamp (unit: ms)
# 把 s 代換成 DataFrame 中的時間欄位
s.apply(lambda x: int(datetime.datetime.strptime(x,"%Y-%m-%d %H:%M:%S").strftime('%s'))*1000)
@VioletVivirand
VioletVivirand / transformation.py
Created April 24, 2017 08:53
Transformation of DataFrame
pd.DataFrame(list(zip(df.columns.tolist(),df.iloc[0,:].values.tolist())), columns=["node", "value"])
[
[1483228800000,2],
[1483228820000,4]
]
[
{"time":1483228800,"value":10},
{"time":1483228820,"value":0}
]
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
callback("Day,Visits,Unique Visitors
3/9/13,5691,4346
3/10/13,5403,4112
3/11/13,15574,11356
3/12/13,16211,11876
3/13/13,16427,11966
3/14/13,16486,12086
3/15/13,14737,10916
3/16/13,5838,4507
3/17/13,5542,4202