Skip to content

Instantly share code, notes, and snippets.

@mendicantx
mendicantx / pros and cons.txt
Created March 12, 2012 19:01
Pros and Cons of Phantomjs
Pros
- Command Line based
- can use report runners that get tied in to CI environments (we use team city and can fail on failed specs)
- Includes built in support for fixtures/dom/etc
Cons
- With our current solution, you have to manage and maintain the SpecRunner.html (seems jasmine gem builds this for you)
Other
- Command line program is OS Specific -- Might need to package a different command line client for OSX/Windows/Linux
@mendicantx
mendicantx / Test.cs
Created March 7, 2012 21:06
Testing
[Observation]
public void it_should_find_the_user()
{
result.FirstName.should_be_equal_to("Jason");
result.SID.should_be_equal_to("S-1-5-21-771950728-121863317-980507067-7249");
//If I ever leave the company, whoever has to fix this test will hate me. As I hated those who came before me.
}
@mendicantx
mendicantx / web.config
Created February 29, 2012 18:53
Web.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="use.web.config" value="false"/>
</appSettings>
</configuration>
@mendicantx
mendicantx / Repository.cs
Created February 28, 2012 17:41
Repository
public interface IRepository
{
TEntity Get<TEntity>(Guid id) where TEntity : IEntity;
TEntity FindOne<Query, TEntity, Tparam>(Tparam param) where Query : ISingleItemQuery<TEntity, Tparam>, new();
IEnumerable<TEntity> FindAllFor<Query, TEntity, TParameter>(TParameter parameter)
where Query : IFindAllQuery<TEntity, TParameter>, new()
where TEntity : IEntity;
@mendicantx
mendicantx / idea.txt
Created January 30, 2012 03:36
I've got an idea for a Startup
Based on: http://www.youtube.com/watch?v=NEsgxoNqQKs
I've got an idea for a startup
and it goes like this
(Check it out) We're gonna build a bigger, better facebook
and it'll be the shit
And we'll get lots of users
I think it could be big
Is it too soon to whisper funding?
<property name="release.environments" value="test,uat,production" />
<target name="package.releases">
<foreach item="String" in="${release.environments}" delim="," property="release.environment">
<property name="package.target" value="package.${release.environment}" />
<call target="${package.target}" />
</foreach>
</target>
@mendicantx
mendicantx / Circumference
Created May 27, 2011 21:46
Tell me I'm not crazy
Okay, given the image and assuming it's a sphere and given:
Image: http://imgur.com/Qmsp0
d1 = 6
r1 = 3
We know that Circumference is:
C1 = 2*3.14159*3 = 18.84954
- How do I get a persistent history between sessions? -- I have found a hack involving CSV files with this once. It didn't work so well
- How do I get a sane tab-completion? -- ie. if I have 3 files named txt_file_001.txt to txt_file_100.txt, typing t<tab> should give me txt_file_, not txt_file_001.txt and keep tabbing through. If need be, i guess pointing me in the direction of an extension point is good enough.
- One of my fav features of bash is search-history-backward and search-history-forward. Essentially, if I were to type cd then press the key I bound to search-history-backward (I use the up arrow, a throwback to tsch and my FreeBSD days) it will only bring up commands in my history that begin with cd . If I do cd c:/projects and start pressing the up/down arrow it will only bring up commands that begin with that. Ideas or extension points would be grand.
Those are my 3 biggest usability complaints right now. If we can get going on these, I'll come up with more. But with those solved and some alias
#!/bin/bash
powershell -Command $*
#place in your path (ex: /usr/local/bin) and now just prefix your powershell command with psh. Ex: psh dir will do a dir.
#uses transient baz
class Foo
def new(baz = Baz.new)
@baz = baz
end
# do stuff with baz here
end