Skip to content

Instantly share code, notes, and snippets.

View chartjes's full-sized avatar

Chris Hartjes chartjes

View GitHub Profile
This is my composer.json file...
{
"name": "api.ibl.org",
"version": "0.0.1",
"repositories": [
{
"type": "package",
"package": {
"name": "codeguy/slim",
A joke for lent:
Just before Pancake Tuesday Jim married his incredibly sexy Irish Catholic girlfriend Mary.
They had a long flight for their honeymoon in Hawaii, getting delayed until Ash Wednesday.
Finally alone in their hotel room Jim intended to consumate the marriage.
Mary blushed and said "Jim, I can't do that! It's Lent"
Jim went nuts: "Leant? To who and for how long?!?"
Here is the scenario I am writing:
Scenario: Create new store with one test product
Given I make the API call "/api/"
When I post a test product
Then I should get back
"""
callback({"success":"true","storeId":"<integer>", "url":"<string>", "embed":"<string>"})
"""
// Check to make sure that our valid fields are in there
$requiredFields = array(
'price',
'name',
'description',
'type',
'shippingCost',
'vendorSku'
);
$valid = true;
// Check to make sure that our valid fields are in there
$requiredFields = array(
'price' => 1,
'name' => 1,
'description' => 1,
'type' => 1,
'shippingCost' => 1,
'vendorSku' => 1
);
$valid = true;
$requiredFields = array(
'price',
'name',
'description',
'type',
'shippingCost',
'vendorSku'
);
$valid = true;
var http = require('http');
var pg = require('pg');
var connectionString = "pg://chartjes:********@localhost:5432/ibl_stats";
pg.connect(connectionString, function(err, client) {
if (err) {
console.log(err);
} else {
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
var http = require('http');
var pg = require('pg');
var connectionString = "pg://chartjes:*******@localhost:5432/ibl_stats";
pg.connect(connectionString, function(err, client) {
if (err) {
console.log(err);
} else {
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'application/json'});
var q = "SELECT * " +
"FROM transaction_log " +
"WHERE log_entry LIKE 'Trades%' " +
"AND transaction_date <= (SELECT MAX(transaction_date) FROM transaction_log) " +
"AND transaction_date >= (SELECT MAX(transaction_date) FROM transaction_log)-'3 weeks'::interval " +
"ORDER BY trans_id DESC ";
// Front controller for our API
var application_root = __dirname;
var express = require("express");
var path = require("path");
var pg = require('pg');
var app = express.createServer();
function TransactionModel(pg) {
this.getCurrent = function(pg) {