Skip to content

Instantly share code, notes, and snippets.

@trevershick
trevershick / WatchMe.java
Created October 16, 2013 13:56
Sample code showing how even after a Guava transform, the underlying collection may still be altered.
import static com.google.common.collect.Collections2.transform;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
@trevershick
trevershick / MakeYojimboNoteFromFlaggedEmail.applescript
Last active December 22, 2015 01:19
Applescript to take flagged e-mail in Apple Mail and create Yojimbo items tagged with 'todo'. I sourced quite a bit of this from multiple places. I apologize for not keeping the references...
#! /usr/bin/osascript
set _count to 0
if not (application "Mail" is running and application "Yojimbo" is running) then
return
end if
tell application "Mail"
repeat with _account in accounts
try
set _inbox to _account's mailbox "Inbox"
@trevershick
trevershick / gist:4648928
Last active December 11, 2015 19:29
Simple Python List Comprehension Example
>>> [ (e.id, e.title) for e in Entry.objects.all() if e.status == Entry.STATUS_LIVE ]
[(5, u'Test Entry 2'), (3, u'Test Title 0')]
on run {input, parameters}
set thePrefix to ""
set defectTitle to "Default Defect Title"
set theIcon to note
repeat
display dialog thePrefix & "Please enter a defect title for " & input & " : " default answer defectTitle with icon theIcon
@trevershick
trevershick / .muttrc
Created April 12, 2012 12:16
Setting up Mutt and Apache James
set smtp_url="smtp://localhost:25"
set pop_host="pop://localhost:110"
set pop_user=me
set pop_pass=me
@trevershick
trevershick / search.groovy
Created March 30, 2012 02:40
A simple groovy script that will allow a command line search of search.maven.org
#!/usr/bin/env groovy
import groovy.json.*
/**
* calculate the maximum value returned from the closure
* for the given collection.
*/
def maxLength(collection, closure) {
collection.inject(0) { acc,val -> Math.max(acc, closure(val)) }
sdtxs01@sdtxs01-MS-7366:~/Dropbox/Strayer/CIS328/chapter_9_1$ src/chapter_9_1
Please enter the name of the file
COPYING
Results for COPYING
===============================================
Characters :35148
Words :5644
Lines :675
@trevershick
trevershick / maven3cobertura.gist
Created December 20, 2011 13:53
Maven 3 Cobertura Plugin Log File
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Results :
Tests run: 66, Failures: 0, Errors: 0, Skipped: 0
Cobertura: Error reading file E:\hudson\workspace\tankcarcoc-dev\source\core\target\cobertura\cobertura.ser: null
Cobertura: Loaded information on 54 classes.
Cobertura: Coverage data file E:\hudson\workspace\tankcarcoc-dev\source\core\target\cobertura\cobertura.ser either does not exist or is not readable. Creating a new data file.
Cobertura: Saved information on 1 classes.
EquipmentIdRange = jook.eqp.EquipmentIdRange;
EquipmentParser = jook.eqp.EquipmentParser;
ExampleTest = TestCase("ExampleTest");
ExampleTest.prototype.testAdjacent_T1 = function() {
var r1 = new EquipmentIdRange("BNSF",1,10);
var r2 = new EquipmentIdRange("BNSF",11,12);
var r3 = new EquipmentIdRange("BNSF", 20,21);
assertTrue(r1.isAdjacentTo(r2));
package com.railinc.sso.zuul.legacy;
// imports removed
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("com.netegrity.policyserver.smapi.ActiveExpressionContext")
public class GetAccessCookieActiveExpressionTest {
public ActiveExpressionContext build_nice_ae_context(UserContext uc, APIContext ac) {