Skip to content

Instantly share code, notes, and snippets.

View shkesar's full-sized avatar

shubham shkesar

View GitHub Profile
@shkesar
shkesar / euler67
Last active January 18, 2016 09:01
// 7273
object Main extends App {
val triangle = Array(Array(59),
Array(73, 41),
Array(52, 40, 9),
Array(26, 53, 6, 34),
Array(10, 51, 87, 86, 81),
Array(61, 95, 66, 57, 25, 68),
Array(90, 81, 80, 38, 92, 67, 73),
Array(30, 28, 51, 76, 81, 18, 75, 44),
@shkesar
shkesar / game.css
Created January 15, 2016 16:46
Game made with only HTML and CSS - https://news.ycombinator.com/item?id=10903691
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
text-align: center;
font-family: sans-serif;
background: #333;
color: #fff;
@shkesar
shkesar / euler18.scala
Created January 15, 2016 14:16
Project Euler 18
object Main extends App {
val triangle = Array(
Array(75),
Array(95, 64),
Array(17, 47, 82),
Array(18, 35, 87, 10),
Array(20, 4, 82, 47, 65),
Array(19, 1, 23, 75, 3, 34),
Array(88, 2, 77, 73, 7, 63, 67),
Array(99, 65, 4, 28, 6, 16, 70, 92),
@shkesar
shkesar / toBitSet.scala
Created January 15, 2016 13:28
Number to Array of Bits
def toBitSet(n: Int, size: Int): Array[Int] = {
var (a, idx) = (n, 0)
val bits = new Array[Int](14)
while (a > 0) {
if (a % 2 != 0) bits(idx) += 1
else bits(idx) += 0
a = a >> 1
idx += 1
}
@shkesar
shkesar / euler20.scala
Created January 15, 2016 12:36
Project Euler Problem 20
object Main extends App {
def factorial(n: BigInt, acc: BigInt = 1): BigInt =
if (n == 0) acc else factorial(n - 1, acc * n)
def sumOfDigits(a: BigInt) = {
var n = a
val digits = collection.mutable.ArrayBuffer[Int]()
while (n > 0) {
digits += (n % 10).toInt
n = n / 10
@shkesar
shkesar / index.html
Created March 3, 2015 16:48
Dynamic form for inputting auto-complete text fields
<div id="container" style="margin-top:30px"></div>
<button class="btn btn-prmiary" id="btn">Add</button>
@shkesar
shkesar / NaiveBayesSandBox.sc
Created February 10, 2015 09:52
A version of NaiveBayes
// DON'T PUSH CHANGES MADE TO THIS FILE
// ADD IT TO YOUR .gitignore AFTER DOWNLOADING IT ONCE
import org.apache.spark.rdd.RDD
class NaiveBayesModel(val lambda: Double,
val vocabSize: Long,
private val vocabEmotion: Array[Seq[String]],
private val vocabEmotionLength: Array[Int],
val emotions: Array[String],
@shkesar
shkesar / news-post.html
Last active August 29, 2015 14:10
news-post-element
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<polymer-element name="news-post">
<template>
<style>
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>