-
The new rake task assets:clean removes precompiled assets. [fxn]
-
Application and plugin generation run bundle install unless
--skip-gemfileor--skip-bundle. [fxn] -
Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]
-
Template generation for jdbcpostgresql #jruby [Vishnu Atrai]
This file contains hidden or 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
| #old style | |
| a={} | |
| a[:test] = {} | |
| a[:test][:second_test] = 'Hello hash!' | |
| # new style | |
| # emulates working with directories | |
| b = {} | |
| b/:test = {} | |
| b/:test/:second_test = 'Hello hash!' |
This file contains hidden or 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
| ree-1.8.7-2010.02 | |
| ----------------- | |
| units: Finished in 0.930402 seconds. | |
| functionals: Finished in 12.241386 seconds. | |
| integration: Finished in 1.648589 seconds. | |
| rake 20.19s user 4.96s system 98% cpu 25.588 total | |
| ruby-1.9.2p180 | |
| -------------- | |
| units: Finished in 1.504977 seconds. |
This file contains hidden or 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
| module System | |
| extend self | |
| def cpu_count | |
| return Java::Java.lang.Runtime.getRuntime.availableProcessors if defined? Java::Java | |
| return File.read('/proc/cpuinfo').scan(/^processor\s*:/).size if File.exist? '/proc/cpuinfo' | |
| require 'win32ole' | |
| WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors | |
| rescue LoadError | |
| Integer `sysctl -n hw.ncpu 2>/dev/null` rescue 1 | |
| end |
This file contains hidden or 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 'eventmachine' | |
| require 'socket' | |
| require 'kgio' | |
| server = Kgio::TCPServer.new('0.0.0.0', 4242) | |
| module Dispatch | |
| def notify_readable | |
| io = @io.kgio_tryaccept or return | |
| EventMachine.attach(io, Server) |
This file contains hidden or 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
| Rehearsal ----------------------------------------------- | |
| instan_eval 0.258967 0.019441 0.278408 ( 0.485533) | |
| bind.call 0.078391 0.003822 0.082213 ( 0.124251) | |
| -------------------------------------- total: 0.360621sec | |
| user system total real | |
| instan_eval 0.259275 0.004492 0.263767 ( 0.309966) | |
| bind.call 0.042689 0.000107 0.042796 ( 0.043009) |
This file contains hidden or 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
| # RubyGems has this functionality built-in. Just specify | |
| # the particular version you want to use as the first argument | |
| # of the command, surrounded by underscores. | |
| $ gem install rails --version 3.0.9 | |
| ... | |
| $ gem install rails --pre | |
| ... | |
| $ rbenv rehash | |
| $ rails --version |
This file contains hidden or 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 little wrapper on yaml/store to give collection and record access to a | |
| # transaction yaml store. | |
| # | |
| # sample usage | |
| # | |
| # require 'ydb' | |
| # | |
| # db = Db.new | |
| # | |
| # collection = db.collection(:posts) |
This file contains hidden or 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
| # Just an example. | |
| # @video is a direct reference to a '<video>' element. | |
| # $() is assuming jQuery is being used in this example. | |
| @video.addEventListener("loadedmetadata", (event) => | |
| actualRatio = @video.videoWidth/@video.videoHeight | |
| targetRatio = $(@video).width()/$(@video).height() | |
| adjustmentRatio = targetRatio/actualRatio | |
| $(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})") | |
| ) |
This file contains hidden or 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
| class Person | |
| def initialize(name, age) | |
| @name = name | |
| @age = age | |
| end | |
| def set_name(new_name) | |
| @name = new_name | |
| end |