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" | |
def start_server | |
# Remove the X to enable the parameters for tuning. | |
# These are the default values as of Ruby 2.2.0. | |
@child = spawn(<<-EOC.split.join(" ")) | |
XRUBY_GC_HEAP_FREE_SLOTS=4096 | |
XRUBY_GC_HEAP_INIT_SLOTS=10000 | |
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8 | |
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0 |
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
➜ ~ sudo haskell-updater | |
Running haskell-updater using GHC 7.8.4 | |
* Executable: /usr/bin/ghc | |
* Library directory: /usr/lib64/ghc-7.8.4 | |
* Package manager (PM): portage | |
Searching for packages installed with a different version of GHC. | |
No old packages found! |
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 | |
require 'benchmark/ips' | |
require "set" | |
X = (0...10000).sort_by{rand}.take(5000) | |
Y = (0...10000).sort_by{rand}.take(5000) | |
SET_X = Set.new(X) | |
SET_Y = Set.new(Y) |
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
-- A frequent question in IRC is how to delete rows that are duplicates over a set of columns, keeping only the one with the lowest ID. | |
-- This query does that for all rows of tablename having the same column1, column2, and column3. | |
DELETE FROM tablename | |
WHERE id IN (SELECT id | |
FROM (SELECT id, | |
row_number() over (partition BY column1, column2, column3 ORDER BY id) AS rnum | |
FROM tablename) t | |
WHERE t.rnum > 1); |
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
defmodule Curried do | |
defmacro defc({name, _, args}, [do: body]) do | |
curried_args = Enum.map(Enum.with_index(args), fn({_, index}) -> | |
Enum.take(args, index + 1) | |
end) | |
for a <- curried_args do | |
if a == Enum.at(curried_args, Enum.count(curried_args) - 1) do | |
quote do | |
def unquote(name)(unquote_splicing(a)) do | |
unquote(body) |
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
source 'http://production.s3.rubygems.org' |
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
[skin] | |
description=Ajnasz Blue Theme. Midnight Commander skin from Ajnasz. | |
[Lines] | |
horiz=─ | |
vert=│ | |
lefttop=┌ | |
righttop=┐ | |
leftbottom=└ | |
rightbottom=┘ |
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
DISABLED_TASKS = [ | |
'db:drop', | |
'db:migrate:reset', | |
'db:schema:load', | |
'db:seed', | |
# ... | |
] | |
namespace :db do | |
desc "Disable a task in production environment" |
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
test/eex_test.exs:213: warning: missing specification for function 'test respects line number inside middle expressions with keywords'/1 | |
test/eex_test.exs:235: warning: missing specification for function 'test properly handle functions'/1 | |
test/eex_test.exs:255: warning: missing specification for function 'test do not consider already finished functions'/1 | |
test/eex_test.exs:275: warning: missing specification for function 'test evaluates nested do expressions'/1 | |
test/eex_test.exs:290: warning: missing specification for function 'test for comprehensions'/1 | |
test/eex_test.exs:299: warning: missing specification for function 'test unicode'/1 | |
test/eex_test.exs:308: warning: missing specification for function 'test evaluates the source from a given file'/1 | |
test/eex_test.exs:314: warning: missing specification for function 'test evaluates the source from a given file with bindings'/1 | |
test/eex_test.exs:320: warning: missing specification for function 'test raises an Exception when there\'s an error with the given file |
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
Rails.application.assets.find_asset('mail.css').body | |
include Sprockets::Helpers::RailsHelper | |
include Sprockets::Helpers::IsolatedHelper | |
include ActionView::Helpers::AssetTagHelper |