February 2010
22 posts
2 tags
O’Reilly Ruby Best Practices →
Because we value our craft, its important to know the difference between code that is agile, and code that is fragile. Chapter 1 - Driving Code Through Tests Chapter 2 - Designing Beautiful APIs Chapter 3 - Mastering the Dynamic Toolkit Chapter 4 - Text Processing and File Management Chapter 5 - Functional Programming Techniques Code examples from Ruby Best Practices
Feb 28th
1 note
1 tag
Functional Javascript →
Functional is a library for functional programming in JavaScript. It defines the standard higher-order functions such as map, reduce (aka foldl), and select (aka filter). It also defines functions such as curry, rcurry, and partial for partial function application; and compose, guard, and until for function-level programming. And all these functions accept strings, such as 'x -> x+1', 'x+1',...
Feb 28th
2 tags
Сколько секунд было в 2008 году?
С одной стороны 3600*24*366+1=31622401 т.к. 31 декабря была введена очередная секунда координации. Но подвох тут - в географии. Дополнительная секунда координации вводится в полночь по гринвичу (UTC time). Соответственно в восточном полушарии это был уже 2009 год, а в западном еще 2008. Итак, полный ответ в 2008 году - 31622401 секунд в западном полушарии, и 31622400 в восточном. По...
Feb 27th
2 tags
EventMachine Protocol Implementations →
Feb 25th
1 note
3 tags
Ruby Quicktips: Conditional Validation using... →
When you have a model that requires additional information, if a certain condition is met and you need to validate this attribute, this little trick can help. Say we have a user model that needs to validate the truck_serial attribute if the user has the role of driver: class User <...
Feb 25th
97 notes
1 tag
Hg Init: a Mercurial tutorial →
Пособие по Mercurial от Joel Spolsky
Feb 25th
3 tags
SyncEnumerator in ruby
SyncEnumerator creates an Enumerable object from multiple Enumerable objects and enumerates them synchronously Example require 'generator' s = SyncEnumerator.new([1,2,3], ['a', 'b', 'c']) # Yields [1, 'a'], [2, 'b'], and [3,'c'] s.each { |row| puts row.join(', ') } ruby-doc
Feb 24th
1 note
1 tag
Трекинг заказных писем по СНГ →
Россия, Украина, Казахстан, Узбекистан
Feb 23rd
1 tag
Python Tips, Tricks, and Hacks →
Переводы статьи на Хабре Python: советы, уловки, хаки (часть 1) Python Tips, Tricks, and Hacks (часть 2) Python Tips, Tricks, and Hacks (часть 3)
Feb 23rd
1 tag
Материалы продвинутого уровня по Питону →
Feb 15th
2 tags
Interesting refactoring #1
A code that lets you define a date by using syntax like Feb[28][2010]. require 'date' FancyDate = Hash.new do |hash, month| Hash.new do |hash, day| Hash.new do |hash, year| Date.new(year, month, day) end end end Date::ABBR_MONTHNAMES[1..-1].each_with_index do |name,index| Object.const_set(name, FancyDate[index+1]) end refactor my code
Feb 14th
2 notes
3 tags
Offline rss reader
Идея сервиса навеяна статьей на хабре Создать утилиту/сайт, которая(ый) бы на основе Google Reade’a генерил новостной pdf/fb2/txt  и синхронизировался с ридером/нетбуком/коммуникатором. В генерируем документе не должно ката, все что под катом должно вытягиваться автоматически и вставляться в документ в том или ином виде. Основа корректной синхронизации, генерируемые скрытые файлы на...
Feb 14th
2 tags
Linkdump #1
Срез от developers.org.ua Современная версия “RU.PROGRAMMING FAQ” на reddit, reddit.com: FAQ — Must-read programming books? 220+ comments (best comment: “Yes, you must.”) JavaScript на сервере, CommonJS/JSGI: The Emerging JavaScript Application Server Platform Учебник по JavaScript, Contents — Eloquent JavaScript Большая подборка тулов для веб-разработки под Firefox, IE, Opera, Codefusion Lab:...
Feb 12th
1 tag
Реактивные веб-сайты. Электронные версии / Книги...
Целью данной книги является показать важность (иногда по-настоящему критическую) клиентской оптимизации и ключевые моменты и проблемные места. Очень хочется верить, что после прочтения книги у читателей сложится целостное представление о мире, находящемся между страницей в браузере пользователя и серверными мощностями. О том, что происходит, когда в адресной строке браузера вводится адрес или...
Feb 11th
3 tags
ActiveRecord, method_missing и stack level too...
Переопределяя у ActiveRecord модели #method_missing важно помнить, что методы чтения атрибутов генерятся через сам #method_missing Так, например, код class Appearance < ActiveRecord::Base serialize :prefereneces, HashWithIndifferentAccess def method_missing(name, *args) preferences[name] || super end end вывалит Exception SystemStackError: stack level too deep Обойти это можно,...
Feb 10th
1 tag
Dummy Image генерирует графические заглушки...
http://dummyimage.com/480×240
Feb 9th
4 tags
AASM & Acts as Audited
Let’s say you’re implementing rails app for a snowboard rental store. A given snowboard can be in one of 3 states: away for maintenance available at store X on loan to customer Y The company needs to be able to view a rental history for a particular snowboard a particular customer The rental history needs to include temporal data (e.g. Sally rented snowboard 0123 from Dec. 1,...
Feb 8th
“Формирование льда обычно происходит вокруг какой-то мусоринки или пылинки. Если...”
– Получение льда нагреванием воды
Feb 8th
2 tags
“Через пару месяцев использования Сафари начинает отжирать 200% CPU на 30-60...”
– http://levgem.livejournal.com/271531.html
Feb 8th
1 note
“С маками тоже проблема — жуткие тормоза. И при просмотре видео и вообще при...”
– MythBusters: Правда и вымысел о Flash
Feb 8th
(fab) a pure javascript DSL for building async web... →
Syntax is similar to Sinatra in Ruby ( fab )   ( "/hello", function() {     return [       200,       { "Content-Length": 6, "Content-Type": "text/plain" },       "hello!"     ];   }) ( fab )
Feb 8th
3 tags
HOWTO protect against malicious images and other... →
Feb 7th