Skip to content

Instantly share code, notes, and snippets.

View edbond's full-sized avatar
🗽
Working from home

Eduard Bondarenko edbond

🗽
Working from home
View GitHub Profile
<!-- NOTE: some OPTIONS snipped -->
<h1>New Post</h1>
<form action="/posts/new" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="8/3HcKSLX+nP/IsAxQ1hEm9/KkdUHfZqJq3P92ny/28=" /></div>
<select id="post_comments_1_appears_at_1i" name="post[comments][1][appears_at(1i)]">
<option value="2004">2004</option>
</select>
<select id="post_comments_1_appears_at_2i" name="post[comments][1][appears_at(2i)]">
ubuntu 9.04
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
gem 1.3.5
rspec 1.2.8
rspec-rails 1.2.8
*** LOCAL GEMS ***
rails (2.3.3, 2.3.2)
Installed at (2.3.3): /usr/lib/ruby/gems/1.8
(2.3.2): /usr/lib/ruby/gems/1.8
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
gem 1.3.5
rspec 1.2.7
rspec-rails 1.2.7.1
rails 2.3.3
test-unit 2.0.3
ZenTest 4.1.3
cucumber 0.3.90
@edbond
edbond / acl.tt
Created July 12, 2009 16:55
Acl Treetop
# access_control :DEFAULT => '!guest'
# [:new, :create, :update, :edit] => '(admin | user | moderator)',
# :delete => 'admin & (!moderator & !blacklist)'
# 'admin & !(blacklist | moderator)'
# '(admin | moderator) & blacklist',
# '(admin) & (moderator & ((user | school)))'
grammar AclGrammar
rule roles
('('? (not / and / or / role) ')'?)+
@edbond
edbond / gist:142769
Created July 8, 2009 12:12
erlang solution to project euler 224
-module(e224).
-compile(export_all).
%-export([start/0]).
%-define(LIM, 75000000).
-define(LIM, 75000000).
%% 7500 -> 311 ? 419 ?
%-- http://projecteuler.net/index.php?section=problems&id=224
require 'rubygems'
require 'couchrest'
db = CouchRest.database!("http://127.0.0.1:5984/loans")
db.recreate!
doc1 = db.save_doc({:loan_amount => 40000, :loan_period => 4})
doc2 = db.save_doc({:loan_amount => 20000, :loan_period => 2})
doc3 = db.save_doc({:loan_amount => 50000, :loan_period => 9})
diff --git a/app/controllers/admin/blogs_controller.rb b/app/controllers/admin/blogs_controller.rb
index ca3cdf2..390b53b 100644
--- a/app/controllers/admin/blogs_controller.rb
+++ b/app/controllers/admin/blogs_controller.rb
@@ -1,4 +1,4 @@
-require 'application'
+require 'application_controller'
module Admin
class BlogsController < ::ApplicationController
# GET /blogs
@edbond
edbond / bonnie++
Created May 8, 2009 06:15
FS benchmark (bonnie++)
cmd: bonnie++ -f
Ext4 on SSD
-----------
Version 1.03c ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
volcano.local 7G 54663 14 34749 13 98851 20 3694 21
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
-module(freq).
-export([main/0]).
freq(B) when is_binary(B) ->
Arr = array:new([{size,256}, {fixed,true}, {default,0}]),
freq(B, Arr).
freq(<<>>, Arr) -> Arr;
freq(<<B:8,Rest/binary>>, Arr) ->
Old = array:get(B, Arr),
#!/usr/bin/ruby
#
# fetch new torrents from torrents.ru
# and display them as notifications
$KCODE='u'
require 'jcode'
require 'rubygems'
require 'net/http'