Skip to content

Instantly share code, notes, and snippets.

View dwelch2344's full-sized avatar

David Welch dwelch2344

View GitHub Profile
@dwelch2344
dwelch2344 / List.js
Created September 24, 2012 19:56
A simple JS List that extends the native Array structure and adds a remove(index) method
List = function(arr){
if( arr !== undefined){
if( arr instanceof Array == false){
for(var i in arguments){
this.push( arguments[i] );
}
}else{
for(var i in arr){
this.push( arr[i] );
}
→ rails server
/Users/dwelch/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
You can install the extension as follows:
gem install bson_ext
If you continue to receive this message after installing, make sure that the
<fmt:formatDate value="${dateVariable}" pattern="${messages['jQueryDatePostPattern']}" var="printDate"/>
<a href="<c:url value="/worker/search/saved/${savedSearch.id}/pdf">
<c:param name="printDate" value="${printDate}"/>
</c:url>" class="sprite prefix printer button"><spring:message code="generic.print"/></a>
@dwelch2344
dwelch2344 / DriverExample.java
Created October 17, 2012 20:01
Selenium WebDriver example with IE
package co.ntier.selenium;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
@dwelch2344
dwelch2344 / 1_TestController.java
Created October 18, 2012 16:53
Pragmatically add Spring MVC Controllers
package foobar;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class TestController {
@RequestMapping("/test/foobar")
private String filterParams(WorkerSearchParamsDto searchParamsDto, Locale locale) {
StringBuilder builder = new StringBuilder();
SimpleDateFormat date = new SimpleDateFormat(getMessage("datePattern", locale));
if(searchParamsDto.getActive() != null && searchParamsDto.getActive()) {
builder.append(TagUtils.concat(getMessage("search.status", locale), getMessage(WorkerStatus.ACTIVE.getLocalKey(), locale), ": "));
} else if(searchParamsDto.getActive() != null && searchParamsDto.getActive()) {
builder.append(TagUtils.concat(getMessage("search.status", locale), getMessage(WorkerStatus.INACTIVE.getLocalKey(), locale), ": "));
}
@dwelch2344
dwelch2344 / .ackrc
Last active October 11, 2015 21:48
Environment Configs
# case insensitive and recursive by default
-r
# follow symlinks
# --follow
# Smart Case
--smart-case
# Set pager to more (much better than piping)
@dwelch2344
dwelch2344 / JsonServiceImpl.java
Created October 23, 2012 19:04
A untested JsonService for Andre
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.inject.Inject;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
@dwelch2344
dwelch2344 / MyMojo.java
Created October 27, 2012 17:21
Embedded Tomcat
package co.ntier.mojo.first_mojo;
import java.io.File;
import org.apache.catalina.Context;
import org.apache.catalina.Manager;
import org.apache.catalina.startup.Tomcat;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
@dwelch2344
dwelch2344 / gist:4061976
Created November 12, 2012 21:20
Apply test
function f(){ console.log(arguments.length, " => ", arguments); }
f()
// 0 " => " []
f('a', 'b')
// 2 " => " ["a", "b"]
f(['a', 'b', 'c'])
// 1 " => " [ Array[3] ]