Read a CSV file and convert it to a list of JavaScript Objects
- Place index.js and plans.csv in a directory
- run the application using the following command: node index.js
- Complete the application
var Sqlite = require( "sqlite3" ).verbose() | |
var db = new Sqlite.Database( "members.db" ) | |
db.serialize( function() { | |
db.run("DROP TABLE IF EXISTS members" ) | |
db.run("CREATE TABLE members(id varchar(255), name varchar(255), default_plan varchar(255))") | |
db.run("INSERT INTO members(id, name, default_plan) VALUES('1', 'john', '')") | |
console.log( "databse was setup!" ) |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> |
var assert = require("chai").assert | |
var agent = require("superagent"); | |
describe( "sanity test", function () { | |
this.timeout(10000); | |
it( "sanity post", function ( done ) { | |
agent.post( "http://httpbin.org/post" ) | |
.send( {name:"foo"} ) |
package example; | |
import java.util.*; | |
import java.io.*; | |
import static org.junit.Assert.*; | |
import static org.mockito.Mockito.*; | |
import org.junit.*; |
it( 'stubbing example', function() { | |
var b = new main.DataService(); | |
var a = new main.Foo( b ); | |
sinon.stub( b, "lookupMultiplier" ).returns( 2 ); | |
var result = a.calculateValueUsingLookup( 5 ); | |
assert.equal( result, 10 ); |
<!doctype html> | |
<head> | |
<style> | |
.ScoreSheet { | |
display: flex; | |
} | |
.ScoreSheet-Frame { | |
display: inline-block; |
exports.getLowerBounds = function() | |
{ | |
var openReq = indexedDB.open( databaseName ) | |
openReq.onsuccess = function( e ) | |
{ | |
var idb = e.target.result | |
var transaction = idb.transaction( objectStoreName, "readonly" ) | |
var objectStore = transaction.objectStore( objectStoreName ) | |
var keyRangeValue = IDBKeyRange.lowerBound( 18 ) |
Ten-pin bowling is a sport in which a player, or "bowler" rolls a bowling ball down a wooden lane with the objective of scoring points by knocking down as many pins as possible.
There are 10 frames in a game and the total score is the sum of all points from each frame plus any bonuses. In general, one point is scored for each pin that is knocked down. So if a player knocks down three pins with the first shot, then six with the second, the player would receive a total of nine points for that frame. If a player knocks down nine pins with the first shot, but misses with the second, the player would also receive nine points for the frame. Scenario:
Frame 1, ball 1: 3 pins
public interface IPay | |
{ | |
decimal CalculatePay( Employee currentEmployee ); | |
void SendToBigBallerAccount(); | |
} | |
public class BigBallerPay : IPay | |
{ | |
public decimal CalculatePay( Employee currentEmployee ) | |
{ |