Skip to content

Instantly share code, notes, and snippets.

Sebastian Friedrich feldpost

Block or report user

Report or block feldpost

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
feldpost /
Created Nov 18, 2015
Starting Pow w/ Log
rails_server () {
cd /Library/WebServer/railsapps/$*;
touch tmp/restart.txt
# clear the screen
/usr/bin/open -a Terminal
/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down'
return 0
#See a log
tail -f -n 0 log/development.log
View env.sample.js
module.exports = {
pivotal: {
sprintly: {
View .bash_config
console () {
eilzug $*
rails_version=`bundle exec rails -v`
if [[ $rails_version == *2.3* ]]
./script/console --irb=pry
elif [[ $rails_version == *3.* ]]
View datasize.rake
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
View generate_rails_app.rb
#!/usr/bin/env ruby
# Written by Kieran P
# Feel free to fork and modify.
# If you do, send me a message on
# Github details changes and I'll
View epic snow leopard upgrade guide.txt
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
View .kindle_export.rb
# PRINT TO KINDLE in Mac OSX (for Kindle DX)
# HUH?
# - Kindle file depository:
# - drag any supported Kindle file to a local folder
# - file will be automatically transfered whenever Kindle is connected
# - "Print To Kindle" Print menu option (PDF):
# - when Kindle is connected it will print as PDF straight to the Kindle (from anywhere)
# - when Kindle is not connected, it will print to the local folder and is transfered as soon as Kindle is connected
feldpost / custom_matchers.rb
Created May 16, 2009
A custom RSpec Matcher for XML documents
View custom_matchers.rb
# Check if element exists:
# <tt>xml.should have_xml_element("account")<tt>
# Use REXML syntax to address nested elements:
# <tt>xml.should have_xml_element("account/name")<tt>
# Check if element has certain value:
# <tt>xml.should have_xml_element("account/name").with_value("foo")<tt>
# or:
# <tt>xml.should have_xml_element("account", :value => "foo")<tt>
# Check if element has certain attribute:
# <tt>xml.should have_xml_element("account").with_attribute("type")<tt>
View rack_honeypot.rb
# When a spammer wants to attack your site, they'll likely send an automated bot
# that will blindly fill out any forms it encounters. The idea of a "honeypot" is that
# you place a hidden field in a form. That's the honeypot. If this field is filled in, then
# it's almost certain to be a spammer (since a normal user wouldn't have even seen the
# field), and the contents of the form can safely be discarded.
# Normally, you would implement a "honeypot" in a Rails app with some combination of a
# special field in a particular form, and then some logic in the corresponding controller that
# would check for content in the "honeypot" field. This is somewhat of an inefficient
# approach, because it requires special code (not DRY), and bots are still going through an
#This is a start script for nginx. Tested on Unbuntu Edge.
#Should work on Ubuntu, Debian and probably a few other Linux distros.
#Change DAEMON and CONFIG_FILE if neccessary
#Location of nginx binary. Change path as neccessary
You can’t perform that action at this time.