Skip to content

Instantly share code, notes, and snippets.

View jmkoni's full-sized avatar
💻

Jennifer Konikowski jmkoni

💻
View GitHub Profile
import org.eclipse.jetty.http.HttpStatus
import org.scalatra.test.scalatest.ScalatraFunSuite
import pdi.jwt.{Jwt, JwtAlgorithm, JwtClaim}
import java.net.HttpCookie
class MyServletTests extends ScalatraFunSuite {
addServlet(classOf[MyServlet], "/*")
import org.scalatra.ScalatraServlet
class MyServlet extends ScalatraServlet {
get("/") {
authenticateCookie(request) match {
case Some(_) => {
views.html.hello()
}
case None => {
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 {
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:
* http://pauldijou.fr/jwt-scala/samples/jwt-core/
*/
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 =
@jmkoni
jmkoni / GIF-Screencast-OSX.md
Created January 24, 2018 13:25 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

Hello $recruiter,

Thank you for reaching out to me about this position. While the job description sounds like something I would be a great fit for and would excel at, I realize that should I interview for this position, the skills evaluated will be my interviewing skills instead of my technical ones. For example, $company is currently found on http://they.whiteboarded.me, a curated list of tech companies known to use high-pressure interview tactics such as live-coding and whiteboarding. Not only that, setting aside the outcome, my previous interview experience at $company was not a positive one. While I admit I could have

INSERT INTO person ('id', 'first_name', 'last_name', 'email') VALUES (1, 'Rylee', 'Wynn', 'Ryl.WYN2659@yopmail.com');
INSERT INTO pet ('id', 'name', 'owner_id', 'species', 'birth_date') VALUES (1, 'Amani', 1, 'rabbit', '2013-03-30 10:00:00');
INSERT INTO pet ('id', 'name', 'owner_id', 'species', 'birth_date') VALUES (2, 'Brayan', 1, 'snake', '2003-12-03 10:00:00');
INSERT INTO address ('id', 'person_id', 'street_address', 'city', 'state', 'zip_code') VALUES (1, 1, '5836 Leroy', 'Stamford', 'CT', '06999');
INSERT INTO person ('id', 'first_name', 'last_name', 'email') VALUES (2, 'Korbin', 'Stuart', 'Kor.STUART1670@yopmail.com');
INSERT INTO pet ('id', 'name', 'owner_id', 'species', 'birth_date') VALUES (3, 'April', 2, 'cat', '2013-07-13 10:00:00');
INSERT INTO address ('id', 'person_id', 'street_address', 'city', 'state', 'zip_code') VALUES (2, 2, '5244 Summit', 'Hialeah', 'FL', '33007');
INSERT INTO person ('id', 'first_name', 'last_name', 'email') VALUES (3, 'Rebecca', 'Reilly', 'Rebecca.REILLY1364@monumentma
require "json"
require "benchmark"
class Measure
def self.run(&block)
no_gc = (ARGV[0] == "--no-gc")
if no_gc
GC.disable
else
@jmkoni
jmkoni / lpthwdjango
Created August 18, 2013 17:32
Starting project for final LPTHW class
1) Change into directory that you want your project in.
ex: mkdir SongIdentifier
cd SongIdentifier
2) Install and run virtualenv
pip install virtualenv
virtualenv --no-site-packages testenv
source testenv/bin/activate
3) Install required packages: