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
IMAP = { :user => "you@gmail.com", :pass => "yourpassword" } | |
namespace :imap do | |
wrapper = nil | |
task :connect do | |
dir = "#{File.dirname(__FILE__)}/../../../../" | |
require 'imap_wrapper' | |
include ImapWrapper::Constants | |
wrapper = ImapWrapper.new(IMAP[:user], IMAP[:pass], ENV['PURGE'], ENV['VERBOSE']) |
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
One of the problems with requiring SSL for all pages in a site is that you can't rely on a lot of the benefits of browser caching. However, many sites DO require login over SSL. | |
During login process, set a LocalStorage private key. This won't be visible to any attacker. | |
Periodically, ask user to encrypt or hash something asymmetrically and send the (public) result back. | |
If a user sends back the same result twice, or it wasn't encrypted correctly, log them out. | |
This may require some way to track individual tabs - if a user opens a new tab/window, there's likely some way to track this. Maybe they can encrypt the last URL they opened, and set that as a cookie. |
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
class ApiSerializer < ActiveRecord::Serialization::JsonSerializer #:nodoc: | |
def serializable_record | |
@host_name = @options.delete :host | |
@is_supporter = @options.delete :supporter | |
@site_permalink = @options.delete :site_permalink | |
@site_prefix = nil | |
super | |
end | |
def site_prefix |
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
~vp(master)> cat ~/.gitconfig | |
...SNIP... | |
[alias] | |
datetag = !git tag `date \"+%Y%m%d%H%M\"` | |
update = pull --rebase | |
commdiff = log --pretty=oneline --left-right | |
...SNIP... | |
~vp(master)> git commdiff master...staging | |
>bb569b9a8c70a61ecffd4def3ac5e460848e0f36 Merge branch 'master' into staging | |
>f95b7db13fb48b3b5e1c2c484d00909a89f468d5 bulk edit on search page is no longer experimental |
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
module ThinkingSphinx | |
def self.index_documents_in_testing | |
ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs | |
config = ThinkingSphinx::Configuration.instance | |
config.build | |
FileUtils.mkdir_p config.searchd_file_path | |
cmd = "#{config.bin_path}indexer --config #{config.config_file} --all" | |
cmd << " --rotate" if ThinkingSphinx.sphinx_running? |
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
gem 'activesupport', '~> 2.1.1' | |
gem 'sequel', '~> 2.7' | |
gem 'activemerchant', '~> 1.4' | |
%w(array/extract_options hash/keys hash/indifferent_access).each { |lib| require "active_support/core_ext/#{lib}" } | |
class Array #:nodoc: | |
include ActiveSupport::CoreExtensions::Array::ExtractOptions | |
end | |
class Hash #:nodoc: |
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
module MyApp | |
class TestCase < Test::Unit::TestCase | |
def self.transaction(&block) | |
Sequel::Model.db.transaction &block | |
end | |
def transaction(&block) | |
self.class.transaction(&block) | |
end | |
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
class << ActiveRecord::Base | |
def none?(*args) | |
!exists?(*args) | |
end | |
end |
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
# fuck you for judging me! LOL | |
class << ActiveRecord::Base | |
def second(options = {}) | |
first(options.update(:offset => 1)) | |
end | |
def third(options = {}) | |
first(options.update(:offset => 2)) | |
end | |
end |
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
<% @changes.select(&:diffable?).each do |change| -%> | |
<% begin -%> | |
<%= diff_for change %> | |
<% rescue -%> | |
? | |
<% end -%> | |
<% end -%> |
NewerOlder