Create and store a 512-byte random encryption key named secret
:
$ mkkey secret
Encrypt the contents of file
with the secret
key and write it to file.enc
:
$ encrypt secret < file > file.enc
#!/usr/bin/env bash | |
source super.bash | |
foo() { | |
echo hello | |
} | |
super_function foo | |
foo() { |
You will be creating a movies app using Sinatra and the OMDB API.
class ViewController | |
include TableSection | |
def numberOfSectionsInTableView(tableView) | |
2 | |
end | |
def numberOfRowsInSection0(tableView) | |
@data.count | |
end |
class ApplicationController < ActionController::Base | |
# Creates an accessor which is exposed to the view | |
def self.view_accessor(*names) | |
attr_accessor *names | |
helper_method *names | |
end | |
end |
Install XQuartz.
Install dwm using Homebrew (or whatever):
brew install dwm
Create a xinitrc.d
script for dwm:
Capybara.add_selector :record do | |
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) } | |
match { |record| record.is_a?(ActiveRecord::Base) } | |
end |
-# put this in your layout | |
-# what this does it is loads the split_asset application.css file using the correct sprockets name | |
/[if lt IE 10] | |
= stylesheet_link_tag stylesheet_path('application').gsub(/\/assets\//, '/split_assets/') |
In early November, 2012, Apple issued a graphics update for all mid-2012 MacBooks. In a continued streak of stupidity, however, this update forces your Mac to use "Safe Sleep". This means that the entire contents of your RAM is written to your disk every time you put your Mac to sleep. | |
This is retarded on the scale of the Titanic's navigational plan for two reasons: | |
1) Your Mac likely has 8 or 16GB of RAM. This is a ton of wasted disk space; especially on MacBook Airs that ship with only 256GB SSDs to begin with. | |
2) SSDs wear out as you write to them. Each cell of a SSD can only be written to a certain number of times before it becomes read-only. If you put your computer to sleep many times a day, OS X is slowly but surely destroying your SSD with unneeded write cycles. | |
Worst of all, the graphics update makes it IMPOSSIBLE to turn off safe sleep using the standard approach you'll find on Google: |
I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.
Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.
A traditional approach for this on a Rails project is to use something like the acts_as_list
gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position
SQL query.
This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri