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
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g} | |
require File.join(File.dirname(__FILE__), "downmark_it") | |
module WordPress | |
def self.import(database, user, password, table_prefix = "wp", host = 'localhost') | |
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8') | |
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="2.0" | |
xmlns:html="http://www.w3.org/TR/REC-html40" | |
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> | |
<xsl:template match="/"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>XML Sitemap</title> |
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
See blog post at http://vitobotta.com/sinatra-contact-form-jekyll/ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href='/stylesheets/contact-form.css' type='text/css' rel='stylesheet' media='screen' /> | |
<meta name="robots" content="noindex, noarchive, noodp, noydir" /> | |
</head> | |
<body> | |
<% if @sent == true %> |
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
# See blog post at http://vitobotta.com/sinatra-contact-form-jekyll/ | |
%w(rubygems sinatra liquid active_support/secure_random resolv open-uri pony haml).each{ |g| require g } | |
APP_ROOT = File.join(File.dirname(__FILE__), '..') | |
set :root, APP_ROOT | |
set :views, File.join(APP_ROOT, "_layouts") | |
not_found do |
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 Client | |
attr_reader :hostname, :host, :port | |
def initialize(port, host) | |
@port, @host = port, host | |
connect! | |
EM.reactor_thread.join | |
end | |
def connect! |
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
require "rubygems" | |
if defined?(JRUBY_VERSION) | |
gem "activerecord-jdbc-adapter", '>= 1.0.2' | |
gem "activerecord-jdbcmysql-adapter", '>= 1.0.2' | |
gem 'jruby-openssl' | |
gem 'jdbc-mysql' | |
else | |
gem 'mysql2', '= 0.2.7' | |
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
namespace :indexes do | |
desc "List unindexed foreign keys" | |
task :unindexed_foreign_keys => :environment do | |
ActiveRecord::Base.logger = Logger.new('/dev/null') | |
missing_indexes = {} | |
connection = ActiveRecord::Base.connection | |
connection.tables.collect do |table| |
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 | |
# Also see: http://vitobotta.com/resque-automatically-kill-stuck-workers-retry-failed-jobs/ | |
[[ -f /tmp/retry-failed-resque-jobs ]] && rm /tmp/retry-failed-resque-jobs | |
ps -eo pid,command | | |
grep [r]esque | | |
grep "Processing" | | |
while read PID COMMAND; do |
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
@javascript | |
Scenario: confiming when saving inactive | |
Given I expect to click "OK" on a confirmation box saying "Are you sure?" | |
When I press "Save" | |
Then the confirmation box should have been displayed | |
And I should see "TV" in the "Campaign Keywords" section |
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
require 'rack' | |
map '/' do | |
use Rack::Static, urls: ['/assets', '/templates'], root: File.expand_path('../public', __FILE__) | |
app = lambda do |env| | |
headers = { | |
'Content-Type' => 'text/html', | |
'Cache-Control' => 'no-cache' | |
} |
OlderNewer