- 🎨 when improving the format/structure of the code
- 🚀 when improving performance
- ✏️ when writing docs
- 💡 new idea
- 🚧 work in progress
- ➕ when adding feature
- ➖ when removing feature
- 🔈 when adding logging
- 🔇 when reducing logging
- 🐛 when fixing a bug
This file contains 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 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
""" | |
This implements a fairly simple expression language via a Pratt-style parser. | |
The language supports fairly standard floating point literals, such as: | |
5 | |
1.09 | |
.16 | |
12e7 |
This file contains 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
/** | |
* Using Operator Mono in Atom | |
* | |
* 1. Open up Atom Preferences. | |
* 2. Click the “Open Config Folder” button. | |
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up. | |
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden! | |
* 5. Tweak away. | |
* | |
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png): |
This file contains 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 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 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 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 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 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 |
NewerOlder