Skip to content

Instantly share code, notes, and snippets.

View andy0130tw's full-sized avatar
🍌
why no 🍆

Andy Pan andy0130tw

🍌
why no 🍆
View GitHub Profile
@andy0130tw
andy0130tw / bs.dropdown.slide.js
Last active August 29, 2015 14:04
Bootstrap (v3.2.0) Dropdown Slide Effect using jQuery. The first revision is the original one and it's only for comparing code.
/* ========================================================================
* Bootstrap: dropdown.js v3.2.0
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
@andy0130tw
andy0130tw / backbone.localstorage.js
Created July 23, 2014 08:17
Backbone LocalStorage Model
var StorageBase=Backbone.Model.extend({
constructor: function(){
Backbone.Model.apply(this,arguments);
//check if the storage can be used
this.supportLocalStorage=!!localStorage;
this.prefix="lm.v2.";
var self=this;
var addPrefix=function(k){
@andy0130tw
andy0130tw / sidebar.js
Last active August 29, 2015 14:05
Facebook sidebar recreation.(I simply don't know its name...) Using RequireJS and jQuery, but you can easily grab useful parts!
/**
* @file UI.sidebar
* Facebook sidebar recreation
*/
define(["jquery"],function($){
//from http://stackoverflow.com/a/17961266/2281355
var isAndroid = navigator.userAgent.indexOf('Android') >= 0;
var webkitVer = parseInt((/WebKit\/([0-9]+)/.exec(navigator.appVersion) || 0)[1],10) || void 0;
@andy0130tw
andy0130tw / gist.js
Created October 7, 2014 13:15
JavaScript Function Isolation
var root=this;
function getIsolationScript(){
//getting key of global attrs
var buffer="";
for(var x in root)buffer+="try{var "+x+"=void 0}catch(e){}";
//the name of the top-level variable
// should be manually set.
buffer+="var window={}";
return buffer;
@andy0130tw
andy0130tw / gram-schmidt.c
Last active August 29, 2015 14:10
Gram-Schmidt Method
/**
* Written by Andy Pan
* Language: C
* Algorithm: Gram-Schmidt Method
* Creation Date: 2014/12/6
* Last Modified: 2014/12/7
**/
#include<stdio.h>
#include<math.h>
@andy0130tw
andy0130tw / permutation.c
Created December 28, 2014 18:56
non-recursion n! permutation in C
#include<stdio.h>
#include<time.h>
void roll(int a[],int l,int r){
//roll [l,r) leftward
int tmp=a[l],i;
for(i=l;i<r-1;i++)
a[i]=a[i+1];
a[r-1]=tmp;
}
```flow
st=>start
e=>end
op0=>operation: 辨識畫布
op1=>operation: 辨識/猜測座標軸
cond1=>condition: 是否為函數圖形?
op2cd1=>operation: 函數辨識模型
op3=>operation: 嘗試各類函數
op4=>operation: 嘗試組合各類函數
op2cd2=>operation: 曲線辨識模型
@andy0130tw
andy0130tw / matlab-lab4-lab5.md
Last active September 7, 2015 10:57
Matlab Lab Code

MATLAB Code

Solution written by Andy Pan Problems copyrighted by TAs
Mathematics Software 2015 Spring, NTU Written with StackEdit, where you can view the full-rendered version.

[TOC]

編者註

@andy0130tw
andy0130tw / wikiwand-zhtw.js
Created April 7, 2015 11:03
Automatically redirect Chinese Wikiwand pages to Traditional Chinese version!
// ==UserScript==
// @name WW Convert to Trad. Chinese
// @namespace andypan.wikiwand.tradc
// @include http://www.wikiwand.com/zh/*
// @version 1
// @grant none
// @@run-at document-start
// ==/UserScript==
// Use it with GreaseMonkey (for Firefox) or Tampermonkey (for Chrome)!
@andy0130tw
andy0130tw / main.py
Created April 14, 2015 17:11
HSNU Calender Scraper
#!python3
import requests
import datetime
import json
URL = "http://www.hs.ntnu.edu.tw/hsnuwp/wp-admin/admin-ajax.php?date=%s&action=hsnu_cal_get_events"
session = requests.Session()
def fetchEvents(dateStr):
return session.get(URL % dateStr).json()