- Clear feature ownership
- Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, etc)
- CI runs only the tests that matter (future)
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
# Since you already have ssh keypair on your deployment host, you may use it to decrypt | |
# database credentials at load time. | |
# | |
# The solution can be tweaked a bit to decrypt with capistrano at deployment time. | |
# In case where the private key is passphrase protected this won't work but it's pretty straight forward to fix it. | |
# | |
# Hope it's a nice starting point for a more mature solution. | |
# | |
# --Yarin |
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
require 'rspec/mocks/standalone' | |
class Service | |
def self.access_thirdparty_action | |
puts "communicating with the world!" | |
end | |
end | |
class ServiceManager |
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
private Handler createExternalServlet(ImmutableMap<String, ServletHolder> servlets, | |
ImmutableMultimap<String, FilterHolder> filters, | |
ImmutableSet<EventListener> listeners) { | |
// set ServletContextHandler.SESSIONS option | |
final ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS); | |
// set a default SessionHandler | |
handler.setSessionHandler(new SessionHandler()); | |
handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); | |
handler.setBaseResource(Resource.newClassPathResource(".")); |
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
@Path("/secret") | |
public class SecretResource { | |
@GET | |
@Path("/secured") | |
public String showSecret(@Auth User user) { | |
return "Hello " + user.getUsername() + ". This is secret!"; | |
} | |
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
# ~/.osx — http://mths.be/osx | |
############################################################################### | |
# General UI/UX # | |
############################################################################### | |
# Set computer name (as done via System Preferences → Sharing) | |
scutil --set ComputerName "MathBook Pro" | |
scutil --set HostName "MathBook Pro" | |
scutil --set LocalHostName "MathBook-Pro" |
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
#!/usr/bin/env ruby | |
dict = File.open('/usr/share/dict/words', 'r').read | |
letters = ARGV[0] unless ARGV.empty? | |
def can_make?(word, letters) | |
return letters.include? word if word.size == 1 | |
letters.include? word[0] and | |
can_make?(word[1..-1], letters.sub(/#{word[0]}/, "")) | |
end |
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
# put this in ~/.ssh/config | |
Host * | |
Compression yes | |
CompressionLevel 7 | |
Cipher blowfish | |
ServerAliveInterval 600 | |
ControlMaster auto | |
ControlPath /tmp/ssh-%r@%h:%p |
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
# OSX for Hackers (Mavericks/Yosemite) | |
# | |
# Source: https://gist.github.com/brandonb927/3195465 | |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront |
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 my.elasticsearch; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Map; |