Skip to content

Instantly share code, notes, and snippets.

View DavidCulpepper's full-sized avatar

David Culpepper DavidCulpepper

View GitHub Profile
MEDIAN {
@Override
public int getPivotIndex(int firstIndex, int lastIndex, int[] array) {
int middleIndex = (firstIndex + lastIndex) / 2;
int firstValue = array[firstIndex];
int lastValue = array[lastIndex];
int middleValue = array[middleIndex];
numComparisons = 0;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.inspiredcompositions.core.persist;
import java.util.List;
/**
*
private List<CompositionDAO> sources = new ArrayList<CompositionDAO>();
@Override
public Composition getCompositionById(String id) {
Composition mostRecentCompositionWithGivenId = null;
for (CompositionDAO currentSource : sources) {
Composition currentComposition = currentSource.getCompositionById(id);
mostRecentCompositionWithGivenId = getMoreRecentComposition(currentComposition, mostRecentCompositionWithGivenId);
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.inspiredcompositions.core.persist;
import java.util.ArrayList;
import java.util.List;
/**
private void expandLineToMeasures(Line unformattedLine) {
int currentRhythm = 0;
int measureRhythm = this.beatUnit /*
* * wholeNoteValue
*/ / this.beatsPerMeasure;
for (int i = 0; i < unformattedLine.getLengthInNotes(); ++i) {
Note n = unformattedLine.getNote(i);
if (n.getRhythmValue() + currentRhythm > measureRhythm) {
Note secondPart = n.copy();
secondPart.setRhythmValue(n.getRhythmValue() - (measureRhythm - currentRhythm));
@DavidCulpepper
DavidCulpepper / refill.rb
Created January 2, 2013 20:51
Refill Scopes
scope :requested_after, lambda { |requested_at| where(:requested_at.gt => requested_at) }
scope :not_requested_yet, lambda { where(:requested_at => nil) }
scope :requested_after_or_never, -> (requested_at) { |requsted_at| self.or(requested_after(requested_at).selector, not_requested_yet.selector) }
class Api::V1::RefillsController < Api::ApiController
# GET /refills
def index
for_api_client = Refill.for_pharmacies(@api_client.pharmacy_identifiers)
requested_at = Time.now.utc # Intentionally using Time and not DateTime: https://github.com/mongoid/mongoid/issues/400
query_params = request.query_parameters
results = []
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
01-29 16:10:12.233: ERROR/COM.PRAESES.POCKETLIFE(24547): Transaction(id=1908616, user=com.praeses.pocketlifebusiness.model.User@415c2790, payor=null, collectionDate=2010-07-22T10:33:45.000-05:00, transactionType=TransactionType(id=1, shortDescription=null, longDescription=null), weekly=0, monthly=0, quarterly=0, semiAnnually=0, annually=0, suspenseAmount=USD -12.00, cashAmount=USD 12.00, check1Amount=null, check1Number=null, check2Amount=null, check2Number=null, check3Amount=null, check3Number=null, uploadDate=2010-09-30T14:10:19.000-05:00, batchNumber=0, officeManager=null, officeManagerReleaseDate=null, collectingUser=com.praeses.pocketlifebusiness.model.User@415fd5e0, transactionStatus=com.praeses.pocketlifebusiness.model.TransactionStatus@4164b718, undiscountedPremium=USD 0.00, disount=0.0), Transaction(id=2985983, user=com.praeses.pocketlifebusiness.model.User@42e15bc0, payor=com.praeses.pocketlifebusiness.model.Payor@42b13d08, collectionDate=2013-01-04T14:33:02.000-06:00, transactionType=TransactionType
{
"controls": [
{
"title": "Plan & Insured Info",
"elements": [
{
"type": "Label",
"text": "Imported from Calculator"
},
{