View truncate_table.rb
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
def truncate_table table_name | |
config = Rails.configuration.database_configuration | |
connection = ActiveRecord::Base.connection | |
connection.disable_referential_integrity do | |
next if connection.select_value("SELECT count(*) FROM #{table_name}") == 0 | |
case config[Rails.env]["adapter"] | |
when "mysql", "mysql2", "postgresql" | |
connection.execute("TRUNCATE #{table_name}") | |
when "sqlite", "sqlite3" | |
connection.execute("DELETE FROM #{table_name}") |
View custom_inputs.css
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
/* Hide the checkbox offscreen */ | |
.regular-checkbox { | |
display: inline; | |
left: -8000px; | |
position: fixed; | |
} | |
/* Highlight the custom checkbox's border when the checkbox has focus. */ | |
.regular-checkbox:focus + label { | |
border: 1px solid #000; |
View example.php
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
<?php | |
require("postmark.php"); | |
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address"); | |
if($postmark->to("reciver@example.com")->cc('ccreciever@example.com')->bcc('bccreciever@example.com')->subject("Email Subject")->plain_message("This is a plain text message.")->send()){ | |
echo "Message sent"; | |
} |