Skip to content

Instantly share code, notes, and snippets.

View cyhsutw's full-sized avatar

Cheng-Yu Hsu cyhsutw

View GitHub Profile
classdef KmeansClustering < handle
properties
X
k
seeds
indicators
end
methods
@cyhsutw
cyhsutw / responseId.js
Last active August 29, 2015 14:10
Response ID
// (1) 得現在操作的 Form 的回應數量來當作 ID
var responseId = FormApp.getActiveForm().getResponses().length;
// (2) 取得現在操作的 From 底下儲存回應的 Spreadsheet 最後一筆紀錄的 ID
// 因為表單是從第二行開始,所以要減掉 1
var responseId = SpreadsheetApp.openById(FormApp.getActiveForm().getDestinationId()).getLastRow() - 1;
@cyhsutw
cyhsutw / stats.md
Last active August 29, 2015 14:08
Statistics of Real Dataset

DBLP

#ratings #users #items #ratings per user #ratings per item
1495081 180640 141507 8.277 10.565

Movie

@cyhsutw
cyhsutw / FBAPICall.m
Last active August 29, 2015 14:05
FBAPICall.m
void(^requestCompletionHandler)(FBRequestConnection *, NSDictionary<FBGraphUser> *, NSError *);
requestCompletionHandler = ^(FBRequestConnection *conn,
NSDictionary<FBGraphUser> *user,
NSError *err){
if(!err){
NSLog(@"Successfully fetched user info!");
NSLog(@"userInfo = %@", user);
NSLog(@"These will work:");
NSLog(@"email:\t%@", [user objectForKey:@"email"]);

##Utilities

  • CocoaPods : Package manager for Xcode projects.

  • nomad-cli : World-class command line utilities for iOS development.

  • Reachability : Detecting the network availabilities.

  • BlocksKit : Block-based iOS APIs used to replace the ugly delegate pattern.

Example:

[Report] Assignment 3

This document is written in GitHub-flavored markdown. You may view the visualized version here.

##Overview I've done the following items in this assignment:

  • Modify assignment1.l and assignment2.y to generate the assembly code of test1.c.
  • Modify the symbol table structure.

Assignment 3

This document is written in GitHub-flavored markdown, you may view the visualised version here.

##Build the Program

This program can be built using the following commands:

@cyhsutw
cyhsutw / test1.c
Last active August 29, 2015 14:02
//before
int main(){
int a = 3;
int b = 4;
int c = 5;
int d = 0;
// i is undeclared
i = a + b + 3 + 6;
BEGIN;
INSERT INTO hospital (id,name,city,country)
VALUES(1,'A_hospital','Taipei','Taiwan');
INSERT INTO hospital (id,name,city,country)
VALUES(2,'B_hospital','Taipei','Taiwan');
INSERT INTO hospital (id,name,city,country)
VALUES(3,'D_hospital','Tainan','Taiwan');
INSERT INTO hospital (id,name,city,country)
VALUES(4,'C_hospital','Tainan','Taiwan');
INSERT INTO hospital (id,name,city,country)
CREATE VIEW birth_record AS
SELECT p.id AS person_id,
p.given_name AS given_name,
p.birthday AS date_of_birth,
h.country AS country_of_birth,
m.given_name AS mother_name
FROM birth p, hospital h, birth m
WHERE p.mother_id = m.id AND p.hospital_id = h.id ORDER BY p.id ASC;
CREATE VIEW death_certificate AS