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
In response to all the responses to: | |
http://twitter.com/rtomayko/status/1155906157 | |
You should never do this in a source file included with your library, | |
app, or tests: | |
require 'rubygems' | |
The system I use to manage my $LOAD_PATH is not your library/app/tests |
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 "net/http" | |
# Example Usage: | |
# | |
# use Rack::Proxy do |req| | |
# if req.path =~ %r{^/remote/service.php$} | |
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}") | |
# end | |
# 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
# If your workers are inactive for a long period of time, they'll lose | |
# their MySQL connection. | |
# | |
# This hack ensures we re-connect whenever a connection is | |
# lost. Because, really. why not? | |
# | |
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
# | |
# From: | |
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
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 "resque" | |
require "resque/failure/multiple" | |
require "resque/failure/redis" | |
# Configure Resque connection from config/redis.yml. This file should look | |
# something like: | |
# development: localhost:6379 | |
# test: localhost:6379:15 | |
# production: localhost:6379 | |
Resque.redis = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env] |
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
#!/bin/bash | |
# author Gleicon Moraes | |
# q&d for provisioning VirtualBox images for a Hadoop project | |
# works on Mac Os X Snow Leopard. | |
# fill in for the ubuntu iso path (must be absolute or put it on VBox HDD dir) | |
# | |
if [ "$#" -lt 1 ]; then | |
echo "use as createvm <VMName>" | |
exit |
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
# Sinatra minimalist RestMQ | |
# no COMET, just /q/ routes and queue logic | |
# the core of RestMQ is how it uses Redis' data types | |
require 'rubygems' | |
require 'sinatra' | |
require 'redis' | |
require 'json' | |
QUEUESET = 'QUEUESET' # queue index |
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
diff -u -r varnish-2.1.3/bin/varnishd/cache_dir_random.c varnish-quorum/bin/varnishd/cache_dir_random.c | |
--- varnish-2.1.3/bin/varnishd/cache_dir_random.c 2010-03-24 09:44:13.000000000 +0000 | |
+++ varnish-quorum/bin/varnishd/cache_dir_random.c 2010-10-07 18:22:42.506413284 +0000 | |
@@ -75,6 +75,7 @@ | |
enum crit_e criteria; | |
unsigned retries; | |
+ double quorum_weight; | |
double tot_weight; | |
struct vdi_random_host *hosts; |
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
#include "cinder/app/AppBasic.h" | |
#include "cinder/CinderMath.h" | |
#include "cinder/gl/gl.h" | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; | |
class SuperFormulaApp : public AppBasic { | |
public: |
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
middle_name = case full_name | |
when /^.*\s(.*)\s.*$/ | |
$1 | |
else | |
"Peatrice" | |
end |
OlderNewer