Skip to content

Instantly share code, notes, and snippets.

View fsubal's full-sized avatar

fsubal fsubal

View GitHub Profile
@fsubal
fsubal / Euclidean Algorithm
Created August 17, 2013 13:39
Just a simple implementation of Euclidean Algorithm.
import java.io.*;
import java.math.*;
public class euclid{
public static void main(String[] args) throws IOException{
String[] strar=new String[2];
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Input two numbers here:");
String str = br.readLine();
@fsubal
fsubal / Tabs.java
Created August 19, 2013 14:48
Ranking outputter for the manga exhibitions at my university. This is the old version.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.UIManager;
import javax.swing.JPanel;
import java.io.*;
import java.awt.Dimension;
import java.awt.BorderLayout;
import javax.swing.JFileChooser;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.14.1/build/cssreset/cssreset-min.css">
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.10.3.custom.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.3.custom.min.js"></script>
<title>TwitKJ - Rhizomizing your tweets!</title>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Parallax Manga Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<style>
/* General Rayouts */
html{
background: #fff;
@fsubal
fsubal / index.html
Last active August 29, 2015 14:02
Parallax Manga Viewer
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Parallax Manga Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="mangaviewer.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
def regRnd(n:Int):Number = {
val s = for{i <- 1 to n} yield Math.random()
s.reduce(_ + _).toDouble / n
}
//Box-Muller's Method
regRnd(12)
@fsubal
fsubal / most-frequent.scala
Last active August 29, 2015 14:10
Get Most Frequent Strings from List[String]
// get most frequent Strings from the newest n values
def mostFrequent(l:List[String], n:Int): List[String] = {
val id = l.take(Math.min(list.length, i)).unzip._1.groupBy(identity)
val frq = id.maxBy(_._2.size)._2.size
id.filter(_._2.size == frq)
}
function fizzbuzz() {
for(var i=1; i<100; i++){
var n = [i,"",""];
if(i%3 == 0){ n[0]=""; n[1]="Fizz"; }
if(i%5 == 0){ n[0]=""; n[2]="Buzz"; }
console.log(n.join(""));
}
}
func longer(a:String,b:String)->String {
if(countElements(b)>countElements(a)){ return b }
else{ return a }
}
var slist = ["asad","asdfgh","sadfbgnhj","sdfg","sdfxbcgbhmvgn","dfsghbjgknlm","ghfjgkcx"]
slist.reduce("", { longer($0, $1) }) // "sdfxbcgbhmvgn"
@fsubal
fsubal / getFileName.js
Created January 8, 2015 07:17
Get the Name of the Page File
var url = location.href.split("/");
var last = (url[url.length-1])? url[url.length-1] : "index";
var fileName = last.split(".html")[0];