Skip to content

Instantly share code, notes, and snippets.

Jennifer Konikowski jmkoni

Block or report user

Report or block jmkoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jmkoni / sinatra_jira.rb
Created Sep 21, 2018
sinatra-jira main file
View sinatra_jira.rb
require 'sinatra'
require 'net/http'
require 'uri'
require 'json'
get '/' do
erb :form
# TODO: select box for issue type
jmkoni / response.erb
Created Sep 21, 2018
sinatra-jira response
View response.erb
<h2>Thank you for helping us be better!</h2>
<!-- add more text that includes anything you want as follow up from the user -->
jmkoni / form.erb
Created Sep 21, 2018
sinatra-jira form
View form.erb
<h2>Submit a bug to JIRA!</h2>
<form action="/form" method="post">
<p>Name: <br>
<small>Name of bug submitter</small>
<input type="text" name="name">
<p>Descriptive Title: <br>
<small>Example: Got error page when trying to view a page</small>
jmkoni / Gemfile
Last active Sep 21, 2018
sinatra-jira Gemfile
View Gemfile
source ''
gem 'dotenv'
gem 'rubocop'
gem 'sinatra'
gem 'thin'
View english_number.rb
class NumberPrinter
ONES = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
TEENS = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
TENS = ["ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
TRANSLATION = { hundred: 100, thousand: 1000, million: 1000000, billion: 1000000000}
attr_accessor :number
def initialize(number)
@number = number
View MyServletTests.scala
import org.eclipse.jetty.http.HttpStatus
import org.scalatra.test.scalatest.ScalatraFunSuite
import pdi.jwt.{Jwt, JwtAlgorithm, JwtClaim}
class MyServletTests extends ScalatraFunSuite {
addServlet(classOf[MyServlet], "/*")
View MyServlet.scala
import org.scalatra.ScalatraServlet
class MyServlet extends ScalatraServlet {
get("/") {
authenticateCookie(request) match {
case Some(_) => {
case None => {
View JwtTests.scala
import org.scalatest.{Matchers, WordSpec}
import pdi.jwt.{Jwt, JwtAlgorithm, JwtClaim}
class JwtTests extends WordSpec with Matchers {
val expirationNumber = 10
"A user data token" can {
"valid token" should {
View Jwt.scala
import org.json4s.DefaultFormats
import org.json4s.jackson.JsonMethods.parse
import pdi.jwt.{Jwt, JwtAlgorithm}
import scala.util.Try
* This object decodes JWTs that are created by another application.
* There are a few different options available for parsing JWTs and I went with:
View Authentication.scala
import javax.servlet.http.{Cookie, HttpServletRequest}
import play.twirl.api.{Html, HtmlFormat}
import scala.util.{Failure, Success}
object Authentication {
def authenticateCookie(
request: HttpServletRequest): Option[UserTokenData] = {
val token =
You can’t perform that action at this time.