Skip to content

Instantly share code, notes, and snippets.

View ianks's full-sized avatar

Ian Ker-Seymer ianks

View GitHub Profile
import java.util.List;
import java.util.Arrays;
public class ConcurrentQueueTest implements Runnable {
private static ConcurrentQueue<String> q;
private static List<String> list;
private static final int threadCount = 3;
private final int id;
public ConcurrentQueueTest(ConcurrentQueue<String> _q, int _id) {
def conditional(bop: Bop, env: Env, e1: Expr, e2: Expr ): B = {
def compare[T](operator: T => Boolean): B = {
operator(toNumber(eval(env, e1)),toNumber(eval(env, e2)))
}
bop match {
case Eq => B(toNumber(eval(env, e1)) == toNumber(eval(env, e2)))
case Ne => B(toNumber(eval(env, e1)) != toNumber(eval(env, e2)))
case Lt => B(toNumber(eval(env, e1)) < toNumber(eval(env, e2)))
case Le => B(toNumber(eval(env, e1)) <= toNumber(eval(env, e2)))

Scala Idioms: How to DRY out matching?

Below, I have posted a case statement which is obviously full of repeated logic and nested matching. It needs to be refactored a bit, but before I do that I would like to get some opinions from some people with more Scala experience from me (an easy qualification I might add). Here's the mess:

def eval(env: Env, e: Expr): Expr = {
  e match {
s_o_s = ->s do s.map do |_|_| -> do _|_*_|_ end[] end.reduce :+ end
describe Api::V1::ConfirmationsController do
describe '#create' do
it 'redirects to correct page with valid token' do
allow(User).to receive(:confirm_by_token)
.and_return build :user
get user_confirmation_path
expect(response).to redirect_to 'http://example.com'
end
module Api
module V1
class ConfirmationsController < Devise::ConfirmationsController
def show
self.resource = User.confirm_by_token params[:confirmation_token]
yield resource if block_given?
domain = Rails.application.secrets.domain_name
navigate_to_after_confirmation_path resource, domain
end
hello

Adgenomics Server Guidelines

Here is a basic guide to using AdGenomics servers. The topics to be addressed are as follows:

  1. Access priviledges
  2. Setup
  3. Logging in
thsijflsakdjfas
dklgfajsdf