Skip to content

Instantly share code, notes, and snippets.

View trevmex's full-sized avatar
👨‍👩‍👧‍👦

Trevor Menagh trevmex

👨‍👩‍👧‍👦
View GitHub Profile
if (!Array.prototype.filter) {
Array.prototype.filter = function (fun, thisp) {
"use strict";
if (typeof this === "undefined" || this === null) {
throw new TypeError();
}
if (typeof fun !== "function") {
throw new TypeError();
}
@trevmex
trevmex / index.html
Created May 2, 2012 02:09
An HTML page to give you a jumping off point for NOT goofing off.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Do something productive!</title>
<style>
label {
display: block;
margin-bottom: 0.5em;
}
@trevmex
trevmex / pom-snippit.xml
Created May 3, 2012 01:56
Eclipse Maven Plugin for Scala Spring Apps
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
<buildcommand>org.eclipse.m2e.core.maven2Builder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
@trevmex
trevmex / nil_stuff
Created May 8, 2012 19:15
The diff between !foo == nil and !foo.nil?
jruby-1.6.7.2 :013 > !foo == nil
NameError: undefined local variable or method `foo' for #<Object:0x26796e1c>
from (irb):13:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from /Users/tmenag200/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /Users/tmenag200/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /Users/tmenag200/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from /Users/tmenag200/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
@trevmex
trevmex / up.sh
Created June 20, 2012 15:15
up - a bash script that updates either a git or an svn repo
#!/usr/bin/env bash
#
# up - a bash script that updates either a git or an svn repo.
#
# Copyright (c) 2012 Trevor Lalish-Menagh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@trevmex
trevmex / up.sh
Created June 20, 2012 15:15
up - a bash script that updates either a git or an svn repo
#!/usr/bin/env bash
#
# up - a bash script that updates either a git or an svn repo.
#
# Copyright (c) 2012 Trevor Lalish-Menagh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@trevmex
trevmex / git_prompt.sh
Created July 24, 2012 15:06
Add git messaging to your bash prompt
#
# Colors
#
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NORMAL="\[\033[0m\]"
#
# Prompt Setup
@trevmex
trevmex / proposal.json
Created December 20, 2012 14:34
A proposal for allowing multiple CURIEs in HAL for use in values as well as keys.
{
"_links": {
"self": { "href": "/" },
"curies": [{
"name": "ex",
"href": "http://www.example.com/rels/{rel}",
"templated": true
},
{
"name": "ot",
@trevmex
trevmex / cd.sh
Last active December 20, 2015 19:19
A shell script to read in the env.* variables from a .versions.conf file and replace them while in this directory only. Restores them on exit. This is meant to override `cd.` TODO: Make the cd command actually work...
#!/usr/bin/env bash
###
# cd override
#
# This replaces the builtin cd command
###
function init_local_env() {
SAVED_VAR=ENV$(echo $1 | sed -e s:/:_:g | tr "[:lower:]" "[:upper:]")_SAVED
@trevmex
trevmex / .vimrc
Created September 30, 2013 16:23
My first VimL function. It removes all matched lines in a file. Woohoo!
" :RL <regexp> will now remove all matched lines in a file
function! RemoveLine(regexp)
exe '%s,^.*' . a:regexp . '.*$\n,,g'
endfunction
command! -nargs=1 RL call RemoveLine(<f-args>)