Build api responses. Hides the generic parameter behind the static method invocation.
Obsolete. Use MAPPER.convertValue() instead
It's not quite as nice as C#'s as but it works well enough. Uses jackson serialization as a bridge between types, so make sure your types are annotated appropriately for (de)serialization. Jackson throws lots of detailed and potentially useful exceptions -- these are caught and made obscure by returning null instead.
Bar bar = new Bar();
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.foo.bar.baz; //steal from FooApplication.java | |
| import io.dropwizard.setup.Environment; | |
| import org.eclipse.jetty.servlets.CrossOriginFilter; | |
| import javax.servlet.DispatcherType; | |
| import javax.servlet.FilterRegistration; | |
| import java.util.EnumSet; | |
| public class Cors { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Undocumented feature which sets the size to "unlimited". | |
| # http://stackoverflow.com/questions/9457233/unlimited-bash-history | |
| export HISTFILESIZE= | |
| export HISTSIZE= | |
| export HISTTIMEFORMAT="[%y%m%d %T] " | |
| # Change the file location because certain bash sessions truncate .bash_history file upon close. | |
| # http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login | |
| export HISTFILE=~/.bash_eternal_history | |
| # Force prompt to write history after every command. | |
| # http://superuser.com/questions/20900/bash-history-loss |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Project Euler problem 2 | |
| function makeFibSequence(a, b) { | |
| // or ... | |
| // var a = 0; | |
| // var b = 1; | |
| return function () { | |
| var next = a + b; | |
| a = b; | |
| b = next; | |
| return next; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var makeArray = function (arrayLike) { | |
| return Array.prototype.slice.call(arrayLike) | |
| } | |
| var mapNodes = function (fn, selector) { | |
| var nodes = makeArray(document.querySelectorAll(selector)) | |
| nodes.forEach(function (el) { | |
| el.href.match(/^http/) && fn(el.href) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // moved to https://github.com/tifletcher/backbone-event-spy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Update to latest chromium nightly on linux | |
| # Script requires root to properly set up the sandbox | |
| # https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment | |
| # | |
| # I use it with a line like the following in my .bashrc: | |
| # alias canary='CHROME_DEVEL_SANDBOX="/home/tif/bin/chrome-linux/chrome_sandbox" /home/tif/bin/chrome-linux/chrome-wrapper' | |
| # | |
| # ---------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object QuadraticPrimes { | |
| import Primes._ | |
| def makeQuad(a: Int, b: Int): Int => Int = | |
| (n: Int) => (n * n) + (a * n) + b | |
| def primesLength(a: Int, b: Int): Int = { | |
| val f = makeQuad(a, b) | |
| Stream.from(0).takeWhile((x) => isPrime(f(x))).toList.length | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DESTINATION='halbeta' | |
| TARGETS=( | |
| 'www/haldeman' | |
| 'www/public_html' | |
| ) | |
| echo Destination: $DESTINATION | |
| echo Syncing ... |