ruby-concurrency/atomic · GitHub
Provides a value container that guarantees atomic updates to this value in a multi-threaded Ruby program.
Originally linked to:
ruby-concurrency/atomic (Deprecated)
Things to consider when using Travis CI
Travis CI is a free continuous integration testing service. However, it is really fragile and will break more than it will work.
If you choose to use it anyway, learn the lessons we already learnt:
Use a compatible Rubygems for Rails 2.3 on Ruby 1.8.7
Ruby 1.8.7 is not compatible with current Rubygems versions (> 2.0). Runnig rvm rubygems latest-1.8 --force will fix this and install Rubygems version 1.8.29.
To make Travis CI do this, add `before_script: rvm rubygems latest-1....
rbenv: How to update list of available Ruby versions on Linux
When you tell rbenv to install a Ruby it does not know about, you will get an error message.
$ rbenv install 2.1.2
ruby-build: definition not found: 2.1.2
You can list all available versions with `rbenv install --list'.
If the version you're looking for is not present, first try upgrading
ruby-build. If it's still missing, open a request on the ruby-build
issue tracker: https://github.com/sstephenson/ruby-build/issues
(Fun fact: Recent versions of ruby-build will give you a more helpful error message which...
OpenStack nova resize "ERROR: Resize requires a change in size"
If you get this error when you try to resize an OpenStack instance:
# nova resize example 23 --poll
ERROR: Resize requires a change in size. (HTTP 400)
You need to change your flavor to have a different memory size. It's a bug in an older OpenStack version:
# /nova/compute/api.py
if (current_memory_mb == new_memory_mb) and flavor_id:
raise exception.CannotResizeToSameSize()
which got fixed 2012-09-12 ([https://git.openstack.org/cgit/openstack/nova/commit/nova/compute/api.p...
Collection of Rails development boosting frameworks
Development environment setup
- Rails Composer
-
Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server, template engine, unit and integration testing frameworks and more.
Generate an app in minutes using an application template. With all the options you want!
Code generators
- Rails Bricks
-
A command line wizard. Once you get it running, it creates sleek applications.
RailsBricks enables you to cre...
Git: Switching back to the previous branch
Using git checkout - you can switch back to the branch you previously worked on.
(master) $ git checkout foobar
Switched to branch 'foobar'
(foobar) $ git checkout -
Switched to branch 'master'
(master) $
This also works with other commands like git merge:
(master) $ git checkout foobar
Switched to branch 'foobar'
(foobar) $ git merge -
Merged branch 'master'
git: How to forget a recorded resolution
If you recorded a bad fix for a conflict, you can tell git to forget that bad resolution:
git rerere forget your_file.rb
Afterwards, the badly resolved file will still be in your working directory. To get it back with confict markers, say:
git checkout -m your_file.rb
Resolve the conflict again, properly now. ;)
Trailer, a faster and easier way to deal with pull requests
Introducing Trailer from HouseTrip, a simple menu bar app that helps you manage your GitHub pull requests. It’s one feature we felt was lacking from our workflow!
Installing therubyracer and libv8 with Ruby 1.8 on OSX Mavericks
There seems to be no way to use therubyracer -v '0.11.4' and libv8 -v '3.11.8.17' on OS X Mavericks.
However, running bundle update therubyracer worked for me. It installed therubyracer -v '0.12.1' and libv8 -v '3.16.14.3' and I had not side effects.
Log of my attempts to get it working
Probably you got here when bundling failed building native extensions for therubyracer.
The libv8 (3.3.10.4) should have been installed when bundling. Unfortunately it is not building correctly on Mavericks, so the libv8.a f...
The new Modularity 2 syntax
We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically.
There is no does method anymore
We now use traits with the vanilla include method:
class Article < ActiveRecord::Base
include DoesTrashable
end
When your trait has parameters, use square brackets:
class Article < ActiveRecord::Base
include DoesStripFields[:name, :brand]
end
Note how you ...
How to set git user and email per directory
I am using git at several places: at work, at university, and at home. I want an own git user/email for each of those places, but I don't want to care setting the values each time I create or clone a new repository.
Git allows for setting user/email per repository, globally and system-wide, but I need a fourth dimension: per directory. By setting git environment variables using ondir, I managed to get exactly what I need.
- Install
ondir(on a Mac:brew install ondir, other OSs need to install it from the linked page). - Put these ...
HubSpot/mixen · GitHub
It's mixins (modules) for Coffeescript classes. Other than most homegrown approaches, this one allows you to keep using super.
safe_cookies is now in public beta
We proudly release our safe_cookies middleware into public beta and just published it on Github.
Features are:
- make all application cookies
secureandHttpOnly(keeping them from being sent over HTTP and protecting them from Javascript) - rewrite all client cookies once, making them
secureandHttpOnly - notification if a request has unregistered cookies (no unsecure cookie will slip by)
- ability to ignore external cookies, like
__utmaand other tracking cookies - easy configurat...
Speeding up ssh session creation
Establishing a new SSH connection usually takes only a few seconds, but if you’re connecting to a server multiple times in succession the overhead starts to add up. If you do a lot of Git pushing and pulling or frequently need to SSH to a dev server, you’ve probably felt the pain of waiting for SSH to connect so you can get back to doing work.
redshift
For all late night coders:
The program "redshift" changes your monitors' white balance according to your position on the planet and your local time. This is supposed to put less strain on your eyeballs than staring at a "daylight white" screen all day and night.
The program is in the Ubuntu repositories, so a simple "sudo apt-get install gtk-redshift" transfers it onto your hard drive.
I find the effect rather pleasing and so I have set the following alias on my computer:
alias rdshft='gtk-redshift -l 48.3714407:10.8982552 -t 6500:4200 &'...
Git & Mac: Working with Unicode filenames
I had some problems with Git and the file spec/fixtures/ČeskýÁČĎÉĚÍŇÓŘŠŤÚŮÝŽáčďéěíňóřšťúůýž. After pulling the latest commits, it would show that file as untracked, but adding and committing it would throw error: pathspec 'check in unicode fixture file once again' did not match any file(s) known to git.
Solution
Install Git version > 1.8.2 using homebrew and set
git config --global core.precomposeunicode true
Done.
Reason
According to the linked Stackoverflow post ...
... the cause is the different im...
Git: How to remove ignored files from your repository's directory
When you have files in your .gitignore they won't be considered for changes, but still you might want to get rid of them, e.g. because they clutter your file system.
While a regular git clean will ignore them as well, passing the -x switch changes that:
git clean -x
If you want to see what would happen first, make sure to pass the -n switch for a dry run:
git clean -xn
Clean even harder by passing the -f (force cleaning under certain circumstances; I think this is also required by default) or -d (removes director...
Automated "git bisect" will make your day
So you're hunting down a regression (or just a bug) and want to use git bisect to find out when it was introduced? Smart kid.
If you have a shell command ready to reveal if your current state is good or bad, you can have git do most of the work for you.
Using git bisect run <your command> you can tell git that your command will reveal the issue; git on the other hand will use the return value of that call to decide if the state is good or bad.
...
Sprites with Compass
Using CSS sprites for background images is a technique for optimizing page load time by combining smaller images into a larger image sprite.
There are ongoing arguments on how useful this still is, as modern browsers become more comfortable to load images in parallel. However, many major websites still use them, for example amazon, [facebook](...
Upgrading Rails 2 from 2.3.8 through 2.3.18 to Rails LTS
This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to 2.3.18, and then, hopefully, Rails LTS.
2.3.8 to 2.3.9
This release has many minor changes and fixes to prepare your application for Rails 3.
Step-by-step upgrade instructions:
- Upgrade
railsgem - Change your
environment.rbso it saysRAILS_GEM_VERSION = '2.3.9' - Change your ...
asciidisco/Backbone.Mutators · GitHub
Backbone plugin to override getters and setters with logic.
git: How to always pull with rebase
In order to have more human readable git branches, do
git pull --rebase
To always pull like this, write these lines to your ~/.gitconfig:
[pull]
rebase = true
..or use this oneliner
git config --global pull.rebase true
Note that this will break if you pull from other upstream branches like
git pull origin other-branch
If you keep rebasing by default, you can get "merge pulls" like this:
git pull --no-rebase origin other-branch