Instant Markdown previews from Vim
Live markdown previewer (with Github flavored syntax) for VIM.
Will open a preview in your browser and update automatically on each key press.
Related cards:
Remove carriage returns from DOS-formatted text files using Vim
If you need to strip carriage return characters from a text file, you can use Vim:
vim file.txt
:set ff=unix
:wq
Preview Github-flavored Markdown from the bash with ianks/octodown
Preview what your markdown would look like on Github. Helpful e.g. when writing or extending a Readme for your gem or projects.
Installation
sudo apt-get install cmake libicu-dev # required for building native extensions
gem install octod...
Some useful vim settings
Below is a list of some VIM settings I find useful. You can add them to your .vimrc
.
source $VIMRUNTIME/mswin.vim " adds Ctrl-X, Ctrl-C, Ctrl-V; block visual mode is now Ctrl-Q
behave mswin
set autowriteall ...
How to generate GIDs from an ActiveRecord scope
ActiveRecord provides the ids
method to pluck ids from a scope, but what if you need to pluck Global IDs?
While you could just call map(&:to_global_id)
on your scope, this approach would instantiate each r...
How to install packages from newer Ubuntu releases
We're usually running Ubuntu LTS versions. Sometimes newer hardware requires packages from more recent Ubuntu releases that only come with 6 months of support. If there is really no other way, it's possible to install packages from later Ubuntu re...
Enable soft tabs in Vim
If you want to enforce soft tabs (spaces instead of tabstops) in Vim put this into your ~/.vimrc
(Linux) or C:\Users\<Username>\_vimrc
(Windows):
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
You can also cal...
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 fi...
Rails: Talking to the database without instantiating ActiveRecord objects
Instantiating ActiveRecord objects comes expensive. To speed up things, you can choose a more direct way to talk to your database: the [ActiveRecord::ConnectionAdapters::DatabaseStatements
](http://api.rubyonrails.org/classes/ActiveRecord/Connect...
An incomplete guide to migrate a Rails application from paperclip to carrierwave
In this example we assume that not only the storage gem changes but also the file structure on disc.
A general approach
Part A: Create a commit which includes a script that allows you to copy the existing file to the new file structure.
...
Vim: How to write a file you opened without sudo
Have you ever opened a file with vim, edited it and when you wanted to save your changes it told you "Can't open file for writing", because you opened it without sudo
? There's an easy hack to let you write it anyway:
:w !sudo tee %
The...