Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
require 'thread' | |
require 'active_support/buffered_logger' | |
# ActiveSupport::BufferedLogger is not completely thread-safe ! | |
# well it is if you disable the silencer : | |
# | |
# ActiveSupport::BufferedLogger.silencer = false | |
# | |
# yet Rails might still re-invent the silencing logic and set the | |
# `logger.level = Logger::ERROR` by hand instead of delegating to |
replica_sets = mm_env['replica_sets'] # node1:port&node2:port | |
rs_list = replica_sets.split("&").map {|rs| host,port = rs.split(":"); [host,port.to_i] } | |
MongoMapper.connection = Mongo::RetryReplicaSetConnection.new(*(rs_list << {:read_secondary => true, :auto_refresh => true })) | |
MongoMapper.database = mm_env['database'] | |
MongoMapper.database.authenticate(mm_env['username'], mm_env['password']) |
#!/usr/bin/env ruby -w | |
# brew-services(1) - Easily start and stop formulas via launchctl | |
# =============================================================== | |
# | |
# ## SYNOPSIS | |
# | |
# [<sudo>] `brew services` `list`<br> | |
# [<sudo>] `brew services` `restart` <formula><br> | |
# [<sudo>] `brew services` `start` <formula> [<plist>]<br> |
# inspired by https://github.com/rspec/rspec-core/pull/596 | |
require 'rspec/core/formatters/base_formatter' | |
module RSpec | |
module Core | |
module Formatters | |
class FailuresFormatter < BaseFormatter | |
def dump_failures | |
return if failed_examples.empty? |
# Do not use this code in any production systems, really. | |
# | |
# Right now that that is out of the way, this is a hacked together | |
# 'see if it can be done' Rails logger for Logstash. | |
# | |
# It is a first look to see what would need to be done to replace | |
# standard rails logging with a nice logstash based solution. | |
# | |
# Current notes: | |
# |
set :path_to_repo, "/path_to_repo/" | |
set :running_app_user, "appusername" | |
namespace :webscale do | |
desc "Cache a signed out version of the path. Usage: cap webscale:signed_out_cache_page -s path_to_cache=/films/on_netflix" | |
task :signed_out_cache, roles: :app do | |
cache_base_path = "#{path_to_repo}/public/signed_out" | |
cached_destination_path = "#{cache_base_path}#{path_to_cache}.html" | |
working_path = "#{cached_destination_path}.tmp" |
source "https://rubygems.org/" | |
gem "neo4j" | |
gem "pry" | |
gem "minitest" | |
gem "jbundler" | |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# Copyright (C) [2014] by Keith Tom <keith dot tom at gmail> | |
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE | |
module Rack | |
# disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues. | |
# Usage for Rails: | |
# in config/environments/test.rb | |
# config.middleware.use Rack::NoAnimations | |
class NoAnimations |