This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JointProbabilityTable: | |
def __init__(self, columns, data): | |
self._columns = columns | |
self._probability_index = len(columns) | |
self._data = self._normalize(data) | |
def _normalize(self, data): | |
probability_sum = 0 | |
for row in data: | |
probability_sum += row[-1] | |
for row in data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class COUNT extends EvalFunc<Long> implements Algebraic{ | |
public Long exec(Tuple input) throws IOException {return count(input);} | |
public String getInitial() {return Initial.class.getName();} | |
public String getIntermed() {return Intermed.class.getName();} | |
public String getFinal() {return Final.class.getName();} | |
static public class Initial extends EvalFunc<Tuple> { | |
public Tuple exec(Tuple input) throws IOException {return TupleFactory.getInstance().newTuple(count(input));} | |
} | |
static public class Intermed extends EvalFunc<Tuple> { | |
public Tuple exec(Tuple input) throws IOException {return TupleFactory.getInstance().newTuple(sum(input));} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec scala "$0" "$@" | |
!# | |
object HelloApp extends App{ | |
println("HelloApp") | |
} | |
HelloApp.main(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
if [ $@ == 0 ]; | |
echo "Error - Usage: $0 [PLAY_FRAMEWORK_HOME]" | |
exit -1 | |
fi | |
PLAY_FRAMEWORK_HOME=$1 | |
echo -e "\n# Adopt to Linux/Unix Environment \numask 002">> $PLAY_FRAMEWORK_HOME/play |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var encodeURIParameter= function(obj) { | |
var str = []; | |
for(var p in obj){ | |
if (obj.hasOwnProperty(p)) { | |
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | |
} | |
} | |
return str.join("&"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
jshint: { | |
options: { | |
jshintrc: '.jshintrc' | |
}, | |
all: [ | |
'Gruntfile.js', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class CaseInsensitiveComparator | |
implements Comparator<String>, java.io.Serializable { | |
// use serialVersionUID from JDK 1.2.2 for interoperability | |
private static final long serialVersionUID = 8575799808933029326L; | |
public int compare(String s1, String s2) { | |
int n1 = s1.length(); | |
int n2 = s2.length(); | |
int min = Math.min(n1, n2); | |
for (int i = 0; i < min; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# shell require dependency script | |
# | |
# Usage: | |
# require mvn git ... | |
# | |
# Author : Chen, Hao (@haoch) | |
# Date : Oct 24th, 2013 | |
require(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -cp clojure.jar clojure.main -e "(use 'clojure.xml) (->> (java.io.File. \"pom.xml\") (clojure.xml/parse) (:content) (filter #(= (:tag %) :version)) (first) (:content) (first) (println))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UTILITY MIXINS | |
// -------------------------------------------------- | |
// Clearfix | |
// -------------------- | |
// For clearing floats like a boss h5bp.com/q | |
.clearfix { | |
*zoom: 1; | |
&:before, | |
&:after { |