Skip to content

Instantly share code, notes, and snippets.

View michaelee's full-sized avatar

Michael Lee michaelee

View GitHub Profile
10.times do
puts "Hello world!"
end
import java.util.*;
public class InputTest {
public static void main (String [] args) {
Scanner scanner = new Scanner(System.in);
String s;
int i;
double d;
System.out.println("Enter a string:");
import java.util.*;
public class Accumulator {
private int accum = 0;
public void add(int val) {
accum = accum + val;
}
public int getValue() {
import java.util.*;
public class Accumulator {
private int accum = 0;
public void add(int val) {
accum = accum + val;
}
public int getValue() {
<div id="page">
<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
html, body {
padding: 0;
margin: 0;
height: 100%; /* so that the page is "defined" to be 100% */
}
#page {
position: relative;
min-height: 100%; /* this way the page div stretches to occupy even a short page */
}
#content {
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
get_header();
?>
<div id="content" class="narrowcolumn">
int i = 1,
fact = 1;
// Invariant (fact == i!) is true here
while (i<N) {
i = i + 1;
fact = fact * i;
// Invariant (fact == i!) is true here
#
# js-scheme-0.4 is here: http://code.google.com/p/js-scheme/
#
diff -urN js-scheme-0.4.orig/.htaccess js-scheme-0.4-offline/.htaccess
--- js-scheme-0.4.orig/.htaccess 1970-01-01 09:00:00.000000000 +0900
+++ js-scheme-0.4-offline/.htaccess 2010-04-25 17:10:52.000000000 +0900
@@ -0,0 +1 @@
+AddType text/cache-manifest .manifest
diff -urN js-scheme-0.4.orig/cache.manifest js-scheme-0.4-offline/cache.manifest
@michaelee
michaelee / naive_bayes.py
Created November 13, 2015 14:43
CS 100 Naive Bayes Demo
import csv
import math
from pprint import pprint
CLASS_FIELD = 'Survived'
FIELD_SUMMARY_TYPES = {
'Sex': 'bin_prob',
'Age': 'mean_stdev',
'Pclass': 'bin_prob',