It is given that @mrb prefers the inverse of c && s && n && !y
. To calculate his musical preference regarding combinations of the set g = {c, s, n, y}
, we apply DeMorgan's law to c && s && n && !y
, producing: !c || !s || !n || y
. This implies that @mrb will be happy given the presence of y in any combination, but if y is not present, neither can c, s, or n.
So, in the app, I do something like this:
Item.all(:order => sort).select { |item| item.to_s.downcase.include? search.to_s.downcase }
Where sort
is an array of fields to order by. By default (with lazy-loading enabled), the query output from DataMapper looks like the following (on a table of 8601 rows):
~ (0.142849) SELECT "id", "created_at", "updated_at" FROM "items" ORDER BY "artist", "title", "year", "label", "format"
This file contains 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
x = 1 | |
a = [2, 1, 4, 3] | |
[x] + (a - [x]) #=> [1, 2, 4, 3] |
This file contains 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
Name Artist Album Track Number | |
Downstairs Religious Knives The Door 1 | |
Basement Watch Religious Knives The Door 2 | |
On a Drive Religious Knives The Door 3 | |
The Storm Religious Knives The Door 4 | |
Major Score Religious Knives The Door 5 | |
Decisions Are Made Religious Knives The Door 6 | |
Cirrus Minor Pink Floyd More 1 | |
The Nile Song Pink Floyd More 2 | |
Crying Song Pink Floyd More 3 |
This file contains 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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
message="eeee eeee!" | |
else | |
message="$1" | |
fi | |
This file contains 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
tell application "Spotify" | |
set track_name to name of current track | |
set track_artist to artist of current track | |
set track_album to album of current track | |
set track_id to id of current track | |
end tell | |
set AppleScript's text item delimiters to ":" | |
set track_id to third text item of track_id | |
set AppleScript's text item delimiters to {""} |
This file contains 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
#!/bin/bash | |
# Update your tracked branch with the remote copy without adding a merge commit. | |
parse_git_branch(){ git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /'; } | |
branch=`parse_git_branch` | |
git remote update root | |
git rebase root/$branch |
This file contains 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
$('form').live('submit', submitForm(e, $(this)) ); | |
var submitForm = function(e, $form) { | |
e.preventDefault(); | |
// make sure we want to do shit | |
doShit(); | |
// stuff we do after doing shit |
This file contains 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
ruby -e "$(curl -fsSL https://raw.github.com/gist/323731/39fc1416e34b9f6db201b4a026181f4ceb7cfa74)" |
- Gene Amdahl's Law
- How to improve concurrency
- Removing FIFO
- FIFO isn't really needed a lot of the time in a queue of jobs
- can ditch FIFO if order of jobs doesn't matter
- if order matters, have a job fire things that depend on it at completion
- FIFO isn't really needed a lot of the time in a queue of jobs
- Removing FIFO
- fuzzy-FIFO