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
@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
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
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
# 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
class User < ActiveRecord::Base | |
attr_accessible :name | |
has_many :bookings | |
has_many :events, :through => :bookings | |
end | |
class Event < ActiveRecord::Base | |
attr_accessible :title |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 "reactor" | |
require "net" | |
local buffer = {} | |
local server = net:server(function(c) | |
print("connected", c) | |
c:on("end", function() | |
print("disconnected") | |
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
{ | |
"jobs":[ | |
{ | |
"jobname":"ServerPingJob.groovy", | |
"period":5, | |
"timeUnit":"SECONDS", | |
"jobMode":"ASYNCHRONOUS", | |
"disabled":true, | |
"params":[ | |
{ |
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
# This configuration file works with both the Compass command line tool and within Rails. | |
# Require any additional compass plugins here. | |
project_type = :rails | |
sass_options = {:debug_info => true} | |
# Set this to the root of your project when deployed: | |
http_path = "/" | |
# You can select your preferred output style here (can be overridden via the command line): |