Skip to content

Instantly share code, notes, and snippets.

@kyledrake
kyledrake / gist:1498932
Last active August 2, 2016 04:31
Neocities' Rainbows! config file - https://neocities.org
# This is Neocities' Rainbows! config file. We are using this in production to run all our web apps.
# It works really well for us and has been heavily load tested, so I wanted to share it with the community.
#
# In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions,
# it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern
# in MRI.
#
# Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even
# with the GIL. The requests are done concurrently for anything that is based on the IO class. This
# includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@jbasdf
jbasdf / sessions.rb
Created January 30, 2012 21:45
Middleware for Sessions in Goliath Options [Click the star to watch this topic]
require 'rack/utils'
require 'rack/session/abstract/id'
require 'remcached'
require 'em-synchrony/em-remcached'
module Slurper
module Rack
class Session < ::Rack::Session::Abstract::ID
include Goliath::Rack::AsyncMiddleware
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@smd686s
smd686s / Gemfile
Created May 12, 2012 16:29
Goliath.io with Grape and MongoDB
gem 'mongo'
gem 'em-mongo'
gem 'bson_ext'
gem 'goliath'
gem 'grape'
@avdi
avdi / hack.rb
Created May 17, 2012 17:34 — forked from lmarburger/hack.rb
Possible for a module included somewhere to override a class's instance method?
class Base
def call
'call'
end
end
Base.new.call # => "call"
module Override
def new(*)
@josevalim
josevalim / sample output
Created May 24, 2012 17:53 — forked from alco/sample output
Updated Elixir chat demo
defmodule Chat.Client do
# In all of the following functions 'server' stands for the server's pid
def join(server) do
send server, :join
end
def say(server, message) do
send server, { :say, message }
end
@rbarazi
rbarazi / airbrake_adapter.rb
Created July 4, 2012 16:26
Yell Airbrake Adapter
require 'yell'
require 'toadhopper'
class AirbrakeAdapter < Yell::Adapters::Base
setup do |options|
@env = options[:environment]
@airbrake = Toadhopper(options[:api_key])
end
write do |event|
if event.message.respond_to?(:backtrace)
@ToJans
ToJans / anagram.cs
Last active April 30, 2018 14:44
Anagram in golang vs anagram in elixir-lang ; am I missing something obvious here?
using System.IO;
using System;
using System.Linq;
public class Anagram
{
// I am aware about, but have no intention on using
// `string.Equals(a, b, StringComparison.OrdinalIgnoreCase)`
// as that is longer
public static string[] Detect(string subject, string[] Candidates)