Skip to content

Instantly share code, notes, and snippets.

View epochwolf's full-sized avatar

Epoch Wolf epochwolf

View GitHub Profile
From: http://webcache.googleusercontent.com/search?q=cache:www.godsfall.com/bonus001/
Title: Bonus Podcast #001: Out of the Frying Pan
Date: JUNE 29, 2016
iTunes
Observatory
Links for this episode:
Discuss this episode: Godsfall Forum
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails: Welcome aboard</title>
<style media="screen">
body {
margin: 0;
margin-bottom: 25px;
padding: 0;
background-color: #f0f0f0;
Aisle
Bdellium
Czar
Djinn
Euphrates
Fohn
Gnarly
Irk
Hour
Jalapeño
❯ middleman build --clean --verbose
== Activating: sprockets
== Reading: Local config
== Activating: blog
== Activating: blog
== Activating: blog
== Activating: automatic_image_sizes
== Activating: directory_indexes
== Activating: syntax
== Activating: thumbnailer
@epochwolf
epochwolf / to_one_file.rb
Created October 1, 2013 04:00
A script to extract the text from a local copy of unitysaga.com into a single html file suitable for conversion to an ebook. Never underestimate the lengths to which a nerd will go to get something on their kindle.
#!/usr/bin/env ruby
# A script to extract the text from a copy of unitysaga.com into a single file.
# Copyright (C) 2013 epochwolf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
accept = <%= param[:accept] || accept %>
connect = <%= param[:connect] || connect %>
cert = <%= param['cert'] || cert %>
key = <%= param['key'] || key %>
CAfile = <%= param['cafile'] || cafile %>
CRLfile = <%= param['crlfile'] || crlfile %>
class HtmlInput < SimpleForm::Inputs::Base
def input
options = input_html_options
options[:data] ||= {}
options[:data][:widget] = 'ckeditor'
@builder.text_area attribute_name, options
end
end
@epochwolf
epochwolf / save_record.rb
Created August 2, 2011 14:11
Save Record mixing for Application Controller
module ControllerMixins::SaveRecord
def attached_events
@_attached_events ||= []
end
def save_events(&block)
save_events!(&block)
rescue ActiveRecord::RecordNotSaved
@epochwolf
epochwolf / db.rake
Created February 8, 2011 03:23
db:genesis Drop in lib/tasks in a rails application for great justice
namespace :db do
desc "[CUSTOM] Nuke the database, run all migrates on a new database, and reseed."
task :genesis do
# McCoy: Dear Lord. You think we're intelligent enough to... suppose... what if this thing were used where data already exists?
Rake::Task['db:drop'].invoke
# Spock: It would destroy such data in favor of its new schema.
Rake::Task['db:create'].invoke
# McCoy: Its "new schema"? Do you have any idea what you're saying?
Rake::Task['db:migrate'].invoke
# Spock: I was not attempting to evaluate its moral implications, Doctor. As a matter of cosmic history, it has always been easier to destroy than to create.
# route
get "flag/:root_type/:root_id" => 'flags#show', :as => :flag
#linking to it
link_to "Flag this", flag_path("journal", @journal.id)
# the :as option in the route generates a method named "#{option[:as]}_path"
# this method has two ways to call it