Skip to content

Instantly share code, notes, and snippets.

View marcesher's full-sized avatar

Marc Esher marcesher

View GitHub Profile
@marcesher
marcesher / pig.log
Created February 4, 2014 12:55
ye olde stack
worker-11
at java.lang.String.intern()Ljava/lang/String; (Native Method)
at clojure.lang.Symbol.intern(Ljava/lang/String;)Lclojure/lang/Symbol; (Symbol.java:62)
at clojure.lang.Keyword.intern(Ljava/lang/String;)Lclojure/lang/Keyword; (Keyword.java:53)
at clojure.core$keyword.invoke(Ljava/lang/Object;)Ljava/lang/Object; (core.clj:574)
at cfpb.qu.data$get_data_table$fn__4180$fn__4181.invoke(Ljava/lang/Object;)Ljava/lang/Object; (data.clj:176)
at clojure.core$map$fn__4207.invoke()Ljava/lang/Object; (core.clj:2485)
at clojure.lang.LazySeq.sval()Ljava/lang/Object; (LazySeq.java:42)
at clojure.lang.LazySeq.seq()Lclojure/lang/ISeq; (LazySeq.java:60)
at clojure.lang.ChunkedCons.chunkedNext()Lclojure/lang/ISeq; (ChunkedCons.java:59)
@marcesher
marcesher / gist:9863995
Created March 29, 2014 22:21
goimports_if_go.sh
#!/bin/sh
if [[ $1 == *.go ]]
then
goimports -w $1
fi

These are questions about browser testing and state.

Imagine a large suite of browser tests that intend to deeply regression test an application. Like most web apps, this involves different types of state: user permissions, expected data in a database, etc. Testing the application requires logging in as different users and/or user types to test different views into the data.

  1. What are patterns for creating expected state prior to running browser tests?
  2. Is it appropriate for the browser tests to communicate directly with the database of the system under test, creating state in the same manner that you would in an integration test?
  3. How important is it that browser tests be decoupled from the application under test, such that the only thing required to run tests are the tests themselves, which can be pointed at any applicable URL (dev, test, staging)?
@marcesher
marcesher / test.py
Last active August 29, 2015 14:27
Strange hanging behavior with python httplib in one environment only
# Problem: In only one environment, I see behavior with httplib where issuing a request against a FQDN will hang, but works fine with a URL without the domain
# eg request("GET", "http://google.com") hangs, but request("GET", "/") does not
# I only see this problem in one of our hosting environments, on both 2.6 and 2.7
# I cannot replicate it anywhere else
import httplib
cn = httplib.HTTPConnection("google.com", 80, timeout=5)
cn.set_debuglevel(10)
package edu.gmu.mut;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Class Account represents an immutable customer account.
*/
public class Account {
@marcesher
marcesher / BadObject.cfc
Created January 12, 2012 20:51
cfc with no var scoping
component output="false"{
function loop1(){
x = 1;
for( x = 1; x LTE 100; x++ ){
writeLog("x is #x#");
loop2();
}
return x;
}
@marcesher
marcesher / gist:1662639
Created January 23, 2012 11:28
Synthesizing functions in javascript... practical applications?
From David Laing & Greg Malcolm's excellent javascript koans. I'm wondering: What are practical uses cases for this function synthesizing in javascript, where this approach would be preferable to all other possible approaches:
it("should use lexical scoping to synthesise functions", function () {
function makeIncreaseByFunction(increaseByAmount)
{
var increaseByFunction = function increaseBy(numberToIncrease)
{
return numberToIncrease + increaseByAmount;
};
@marcesher
marcesher / eff_you_var_scope
Created February 25, 2012 16:01
How many concurrent requests does it take to get into the throw?
<cfcomponent>
<cffunction name="getArtist" output="false" access="public" returntype="any" hint="">
<cfargument name="id" type="numeric" required="true"/>
<cfquery datasource="cfartgallery" name="artist">
select *
from artists
where artistid = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_integer"/>
</cfquery>
@marcesher
marcesher / ChatService.groovy
Created August 20, 2012 10:06
websocket chat example
class ChatService {
static transactional = false
static atmosphere = [mapping: '/atmosphere/chatty']
@marcesher
marcesher / ChatService.groovy
Created September 4, 2012 22:41
websocket broadcaster example
class ChatService {
static transactional = false
static atmosphere = [mapping: '/atmosphere/chat']
.....