Skip to content

Instantly share code, notes, and snippets.

View infomaven's full-sized avatar

Nadine Whitfield infomaven

  • Independent Software Developer
  • USA
View GitHub Profile
@josephpconley
josephpconley / bookstore.sc
Last active August 29, 2015 13:59
Scala worksheet for play-jsonpath library
//Scala worksheet
import com.josephpconley.jsonpath.JSONPath
import play.api.libs.json.Json
val store = Json.parse("""{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95}}}""")
JSONPath.query("$.store.book[*].author", store)
JSONPath.query("$..author", store)
JSONPath.query("$.store.*", store)
JSONPath.query("$.store..price", store)
JSONPath.query("$..book[2]", store)
@infomaven
infomaven / jsbin.uvecat.html
Last active May 7, 2021 12:40
JavaScript function that converts Hrs & Minutes into Decimal Hrs. It uses a Hash structure in Javascript to store the equivalencies. Intended audience: Use by Employees who need to enter Decimal time values for their time cards at work. Further down the line, this logic will be refactored into a Service that can be used programmatically by time-…
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta name="description" content="[add your bin description]" />
<meta charset=utf-8 />
<title>Decimalizer c.2013 - Nadine Whitfield</title>
</head>
<body>
anonymous
anonymous / jsbin.iyiwit.html
Created July 27, 2013 20:10
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
/**
* Copyright 2011-2012 eBusiness Information, Groupe Excilys (www.excilys.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nremond
nremond / gist:2972382
Created June 22, 2012 12:10
Account feeder
class AccountFeeder() extends com.excilys.ebi.gatling.core.feeder.Feeder {
import org.joda.time.DateTime
import scala.util.Random
private val RNG = new Random()
// random number in between [a...b]
def randInt(a:Int, b:Int) = RNG.nextInt(b-a) + a
def daysOfMonth(year:Int, month:Int) = new DateTime(year, month, 1, 0, 0, 0, 000).dayOfMonth().getMaximumValue()
@ctcarrier
ctcarrier / serviceTest1
Created April 23, 2012 16:09
Gatling scenario
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import scala.util.Random
import com.excilys.ebi.gatling.core.feeder.Feeder
class ServiceSimulation extends Simulation {
def apply = {
val random = new Random
random.setSeed(System.currentTimeMillis)