Ask for Help
"Are there any good enum gems that work with Rails 3.2?"
Try simple_enum. But watch out: by default it will take your array of string values and store the numeric indices in the database. To avoid having to migrate your existing data, you can pass it a hash:
as_enum :status, :pending => "pending", :active => "active"
Interesting Things
"And... clap."
A fun thing to try at standup: get everyone to clap once simultaneously without counting down.
Ask for Help
"pg gem version 0.12.2 seems to be leaving connections open sometimes after our application server is dead. This results in transactions that never finish. Anyone know what's up?"
Interesting Things
- Tracker released major UI updates on Saturday, and we're getting a lot of positive and negative feedback about it. Fear the change!
- If you change code that's part of the rails asset pipeline, it won't really take effect until you deleted the cached files and allow the asset pipeline to regenerate them. This is because the pipeline watches for changes in the input files, but not in the source code.
Ask for Help
"In an android web browser, if I have an autocomplete menu, and I click on one of the items, the click is registered on that item, but also seems to pass through to the elements behind it. For instance, a different text input was behind it, and became focused."
"Yep, that bug sucks." "The world may never know."
Interesting Things
Fixnum's
[]operator works! According to the ruby docs"Bit Reference—Returns the nth bit in the binary representation of fix, where fix is the least significant bit."
# 2:Fixnum in binary is 10, right? So… 2[0] = 0 2[1] = 1Also:
a = 0b11001100101010 30.downto(0) do |n| print a[n] endproduces:
0000000000000000011001100101010innotop
innotopis a 'top' clone for MySQL with more features and flexibility than similar tools. It'll let you do all sorts of dangerous things to your database! Have fun!!Parse.com apparently accepts job applications via API! Check it out at https://parse.com/jobs#api
jQuery and the
resizeevent – If you trigger aresizeeven on any object other than the window, it will not trigger the binding on that element. It will, however, trigger anyresizebindings you have on window.Did you commit to git under the wrong author's name and email? Use
--ammend --reset-authorafter committing, but before pushing (unless you want a pain in the tuchus)mkdir foo cd foo git init touch README git config --global user.name "Santa Claus" git config --global user.email "santa@claus.no" git add . git commit -m "Commit from Santa Claus" git show # commit e5f4ebe6c689ddbf4ff595855fec544da5d8ce01 # Author: Santa Claus <santa@claus.no> # Oops! I'm not Santa Claus git config --global user.name "Easter Bunny" git config --global user.email "easter@bunny.cl" git commit --amend --reset-author git show # commit d523479d487d04388972bea872913ffda734ef89 # Author: Easter Bunny <easter@bunny.cl>Looking to game the system on Superbowl Game day? Check out Onsi's Super Square http://supersquare.heroku.com/ stats app for your Squares pool.
Interesting Things
- When using TimeCop to travel in time in your specs,
Timeworks normally, howeverDateTimewill round to the nearest second. You have been warned
Help!
"What's going on with Facebooker and :class/:class_name_?"
Normally, in an ActiveRecord class definition you can use :class_name to change the class of an association.
has_many :foos, :class_name => 'Bar'
With Facebooker installed, one project found that their project was able to use :class
has_many :foos, :class => 'Bar'
When Facebooker was removed, it all blew up. No one had a solid answer as to why this worked in the first place.
"How do can we tell if our app's email has been marked as spam like Campaign Monitor claim to do? How else can I get spam reports?"
*"Does anyone know to get this info from ISPs?"
Services like Return Path can give you aggregate reports, but not specifics.
All other suggestions were vague and/or said "Contact the ISP."
*"How do I sign up for Heroku with a Google Group email?"
Allow non-member emails. You want to do this before you sign up, because some Pivots have reported that they could not get a second confirmation message to be sent.
Interesting Things
- If you haven't noticed, Jasmine tests are at least twice as fast in Chrome as they are in Firefox. Closing the inspection pane makes it even faster. Be aware that part of the speed is from Chrome's aggressive caching, which can lead to erroneous test results.
- One team is using Backbone's local storage. When they add
model.clear()after every test run, their tests go from 20 seconds to over 100 seconds. Someone suggested thesilent: trueoption, to suppress thechangeevents thatcleartriggers. - To avoid bugs in minified JS put semicolons in the right spots. The easiest way to do that is to run a tool like JSLint or JSHint over your code. Add it to your test suite to prevent mistakes.
Ask for Help
- "In IE8 the numbers don't show up on ordered lists if we dynamically create
lis"
Or rather, they do, but only after hovering over the list. The common wisdom is that this has been broken in IE for a long time.
- "Our project does some DNS resolution. Is there a preferred way to mock this in tests?"
No suggestions.
- "When replying to an email each email system adds different junk to the message. We're processing those incoming replies. Any standard way to strip out the junk?"
Everyone is using the ugly regex approach. Are there mail gems that handle this?
Interesting Things
- There's a new release of Backbone - 0.9.0. It's billed as a release candidate for 1.0, and seems to be a bit buggy, as RCs can be. However, it's exciting to see that Backbone is getting close to that milestone.
- You should default boolean fields to true or false, at the database layer. Otherwise your queries have to deal with three-valued logic.
- Rails 3.2 has some unexpected behavior. First, the generated form ids have changed ... what used to be
id=user_newis nowid=new_user. Second, if your routes file is missing an entry, you will no longer get errors in controller tests. If you liked that behavior, try out request specs.
Ask for Help
- "Anyone seen problems with the latest REE and iconv?"
Everything works on the Linux machines, but on Macs, there's an error about an unrecognized target encoding. Iconv works on the command line, so it's something about REE.
Interesting Things
should_not render_with_layoutcan be flaky. For example, asserting that an XHR request doesn't have a layout could fail if the request renders an email template that does have a layout. These matchers are not very sophisticated, mostly doing string matching, not real template resolution.
Ask for Help
- "How do I test relative time with FixtureBuilder?"
Since the models are all built beforehand, it's tricky to write tests that make assertions about relative time. There were a variety of suggestions. You can write all the tests relative to a model: some_time.should == model.created_at - 3.days. You can wrap the entire suite and fixture generation in a Timecop block, but you'll have to deal with losing that context whenever any test calls Timecop.return.
- "How do I separate multiple FixtureBuilder files, but allow them to reference objects created in each other?"
Typically you want to separate fixtures into smaller files. But, you also often want to reference objects in other files, for example so you can assign a user from user_fixtures.rb to a post in post_fixtures.rb. One solution is to eval each file in a loop, so they can share instance variables. You can also use User.where(:name => "Tom") but that's awkward and repetitive.
- "Any suggestions for a CMS that would allow lots of different visual presentations of the content?"
The questioner is experimenting with branding. Not many suggestions... a shared database perhaps?
Ask for Help
How to scrub production data
- try my_obfuscate
- use handcrafted update-all sql
Interesting Things
- Do not stretch monitor cables, they make the ports break
- MySql: Different os have different rules on table case sensitivity(My_Table <-> my_table), be strict or you get into trouble
- validates_acceptance_of can crash your asest:precompile on heroku (because it uses the db when loaded, but db is not yet ready), least hacky solution: validates_acceptance_of xxx unless ENV['RAILS_ASSETS_PRECOMPILE']
At Pivotal Labs, one of the services we provide our clients is helping them interview and hire. Pivotal Labs and our clients place a strong emphasis on Agile development and its many aspects: Pair Programming, Test-Driven Development, rapid iterations, and frequent refactoring.
Halogen Media Group merged with YouCast Corp. to collaborate in forming a powerhouse of technology, Social Chorus (http://socialchorus.com), that measures social reach through paid and earned media through influencer distribution.
Here's the job posting:
Ask for Help
Enunciate
Adam cant hear you, speak up!
Job chaining in resque
Start the next after the first finishes or create a big wrapper job that does all of them
Inherited resource
Change objects before rendering -- no good answer found
Interesting Things
- Dynamo DB from AWS is out, aparently its faster then simpledb
- SOPA protest today, if you need wiki, try to disable javascript or go to mobile
- June 6th is IPV6 day (all IPV4 gets switched off ;) )
