This file contains hidden or 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
| set expandtab " Use spaces instead of tabs | |
| set autoindent " Inherit indent from previous line | |
| syntax on | |
| set tabstop=2 " Display \t as 2 spaces | |
| "set shiftwidth=2 " Number of spaces to use for each indent | |
| "set softtabstop=2 " Treat 2 spaces as a tab for editing purposes | |
| "set smartindent | |
| "set smarttab " Insert blank space at beginning of line with tab | |
| " make searches case-insensitive, unless they contain upper-case letters |
This file contains hidden or 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
| --- controller --- | |
| def index | |
| load_videos = lambda do | |
| @videos = Video.find(...) | |
| end | |
| end | |
| --- view --- | |
| cache("...") do | |
| load_videos |
This file contains hidden or 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
| # a simple ActiveRecord->HTML table of attributes default (why isn't this builtin?) | |
| # in the case of arrays, just do many tables | |
| # TODO: move to a plugin or somesuch? | |
| module ToHTML | |
| def to_html | |
| # FIXME TODO: things we don't want to show... | |
| @private_attributes ||= [:id, :video_id, :user_id, :cached_tag_list, :points, :identified, :identified_at, :created_at, :service_id] | |
This file contains hidden or 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
| NOOOOOOOOOOOOOOOOOOOOOOO!!!!! | |
| .-. | |
| |_:_| | |
| /(_Y_)\ | |
| ( \/M\/ ) | |
| '. _.'-/'-'\-'._ | |
| ': _/.--'[[[[]'--.\_ | |
| ': /_' : |::"| : '.\ | |
| ': // ./ |oUU| \.' :\ |
This file contains hidden or 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
| desc "Raises an error if there are pending migrations" | |
| task :abort_if_pending_migrations => :environment do | |
| if defined? ActiveRecord | |
| pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations | |
| if pending_migrations.any? | |
| puts "You have #{pending_migrations.size} pending migrations:" | |
| pending_migrations.each do |pending_migration| | |
| puts ' %4d %s' % [pending_migration.version, pending_migration.name] | |
| end |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # | |
| # quickly lookup # of google search results for a given term | |
| # usage: ~/bin/searchresults.rb "internet memes" | |
| # by Jamie Wilkinson <http://jamiedubs.com> | |
| # Free Art & Technology Lab <http://fffff.at> | |
| require 'rubygems' | |
| require 'mechanize' |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # quick Google PageRank lookup | |
| # usage: ~/bin/pagerank jamiedubs.com | |
| # => 6 | |
| # | |
| # by Vsevolod S. Balashov <vsevolod @ balashovREMOVETHIS.name> | |
| # hacks/binify by Jamie Dubs <http://jamiedubs.com> | |
| # based on 3rd party code snippets (see comments) | |
| # TODO: make into a gem... the existing googlePR one is broken! |
This file contains hidden or 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
| SELECT count(*) TABLES, | |
| concat(round(sum(table_rows)/1000000,2),'M') rows, | |
| concat(round(sum(data_length)/(1024*1024*1024),2),'G') DATA, | |
| concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx, | |
| concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size, | |
| round(sum(index_length)/sum(data_length),2) idxfrac | |
| FROM information_schema.TABLES; |
This file contains hidden or 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
| # setting up an R&D slice | |
| # 1st things first, copy over our bash & screen config... | |
| # TODO: | |
| # bootstrap | |
| apt-get update -y && apt-get upgrade -y | |
| apt-get install -y build-essential git-core | |
| apt-get install -y apache2 apache2-prefork-dev postfix imagemagick |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # sup luke; jdubs here | |
| # - put the docs and helper scripts inline for syntax highlighting joy | |
| # - added another crontab example -- I like to file once/day. | |
| # plays nice with treating the Desktop like a daily scratchpad | |
| # - added a 'Yesterday' link in addition to Today | |
| # - minor tweaks around town | |
| ## config | |
| HOME_DIRECTORY = "~" # this will |