Skip to content

Instantly share code, notes, and snippets.

View ilovejs's full-sized avatar
🐡
mememe, hv a good fish !

Michael Zhuang ilovejs

🐡
mememe, hv a good fish !
  • Sydney
  • 09:45 (UTC +10:00)
View GitHub Profile
@ilovejs
ilovejs / Tail Recursion Fibonacci Sequence
Created May 14, 2012 14:22
Tail Recursion Fibonacci Sequence
public class TailRecursion {
//implement fibonacci function
public static void main(String[] args) {
TailRecursion t = new TailRecursion();
int normal = t.nFibo(9);
System.out.println(normal);
int tail = t.tailFibo(9);
System.out.println(tail);
}
//normal calculation
@ilovejs
ilovejs / Directory_Parser.java
Created May 14, 2012 14:24
Directories and Files Printer
import java.io.File;
import java.io.FileFilter;
import java.io.FileWriter;
import java.io.IOException;
public class Dparser {
FileWriter out = null;
public Dparser(){
try {
@ilovejs
ilovejs / gist:2935166
Created June 15, 2012 07:14 — forked from fxsjy/gist:2928683
bpnn solve kindergarten problem
# Back-Propagation Neural Networks
# another way: solve it as a Regression Problem
# Written in Python. See http://www.python.org/
# Modified by JSun to solve the problem here: http://www.weibo.com/1497035431/ynPEvC78V
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
@ilovejs
ilovejs / gist:4214270
Created December 5, 2012 09:32 — forked from fxsjy/gist:3550053
Bakup Weibo to Disk
package main
import (
"net/http"
"net/url"
"log"
"io/ioutil"
"regexp"
"fmt"
//"net/http/httputil"
@ilovejs
ilovejs / svmflag.py
Created December 27, 2012 08:59 — forked from glamp/svmflag.py
import numpy as np
import pylab as pl
import pandas as pd
from sklearn import svm
from sklearn import linear_model
from sklearn import tree
from sklearn.metrics import confusion_matrix
; It is assumed that the following connections on the board are made:
; LCD D0-D7 -> PD0-PD7
; LCD BE-RS -> PA0-PA3
; These ports can be changed if required by replacing all references to the ports with a
; different port. This means replacing occurences of DDRx, PORTx and PINx.
.include "m64def.inc"
.def temp =r16
.def data =r17
.def del_lo = r18
@ilovejs
ilovejs / server.r
Created May 3, 2013 02:37 — forked from wch/server.r
if (!require(quantmod)) {
stop("This app requires the quantmod package. To install it, run 'install.packages(\"quantmod\")'.\n")
}
# Download data for a stock if needed, and return the data
require_symbol <- function(symbol, envir = parent.frame()) {
if (is.null(envir[[symbol]])) {
envir[[symbol]] <- getSymbols(symbol, auto.assign = FALSE)
}
@ilovejs
ilovejs / column height.html
Created July 31, 2013 06:15
From lyndia.com css layout tutorial module 3 - video 8 Please notice the comments down there !! They show the limitation of setting height for columns
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>column height</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
/*
str.replace(/David/g, "Darren"); // "Darren is an Arsenal fan, which means Darren is great"
var clone = myArray.slice(0); // naive clone
var nodesArr = Array.prototype.slice.call(document.querySelectorAll("div")); // "true" array of DIVs
var argsArr = Array.prototype.slice.call(arguments); // changes arguments to "true" array
[