Skip to content

Instantly share code, notes, and snippets.

Earle Clubb eclubb

Block or report user

Report or block eclubb

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
View move-issues-from-jira-to-gitlab.py
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
import urllib
JIRA_URL = 'https://your-jira-url.tld/'
JIRA_ACCOUNT = ('jira-username', 'jira-password')
# the JIRA project ID (short)
JIRA_PROJECT = 'PRO'
@eclubb
eclubb / sqlite2pg.sh
Created Mar 30, 2012
Script to import SQLite3 database into PostgreSQL
View sqlite2pg.sh
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
View gist:1489315
rails generate migration add_image_id_to_blog_posts image_id:integer
rake db:migrate
Override the blog category model and add:
belongs_to :image
Override the blog category form and add an image picker to it:
<div class='field'>
<%= f.label :image -%>
<%= render :partial => "/shared/admin/image_picker", :locals => {
View gist:911734
earle@king ~/projects/websites $ refinerycms/bin/refinerycms dummy
Running: /home/earle/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -S rails new "/home/earle/projects/websites/dummy" --database sqlite3 --skip-test-unit --skip-prototype
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
@eclubb
eclubb / category.rb
Created Apr 8, 2011
HABTM with deferred save error
View category.rb
class Category < ActiveRecord::Base
has_and_belongs_to_many_with_deferred_save :posts
end
View gist:888456
A NoMethodError occurred in pages#update:
undefined method `cache_path' for #<ActiveSupport::Cache::MemoryStore:0x9afc1bc>
/home/orchard_hills_church-staging/apps/orchard_hills_church/shared/bundle/ruby/1.8/bundler/gems/refinerycms-7bd49ac79ab4/pages/app/models/page.rb:241:in `expire_page_caching'
-------------------------------
Backtrace:
-------------------------------
View form.haml
-# Note that in this scenario, there is only one comment.
= simple_form_for @post do |post_form|
...
= post_form.simple_fields_for :comments do |comment_form|
comment_form.input :name
comment_form.input :email
View datamapper.rb
module DataMapper
module Reflection
def self.included(model)
model.extend ClassMethods
end
module ClassMethods
def reflect_on_association(association)
relationship = relationships[association]
MacroReflection.new(relationship, relationship.name, {})
View gist:749293
A ArgumentError occurred in users#forgot:
A sender (Return-Path, Sender or From) required to send a message
mail (2.2.12) lib/mail/network/delivery_methods/smtp.rb:97:in `deliver!'
mail (2.2.12) lib/mail/message.rb:1964:in `do_delivery'
mail (2.2.12) lib/mail/message.rb:228:in `deliver'
actionmailer (3.0.3) lib/action_mailer/base.rb:401:in `deliver_mail'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
View gist:44817
$ sudo gem uninstall do_sqlite3
Successfully uninstalled do_sqlite3-0.9.10.1
$ sudo gem install -l pkg/do_sqlite3-0.9.10.1-x86-linux.gem --no-rdoc --no-ri
Successfully installed do_sqlite3-0.9.10.1-x86-linux
1 gem installed
$ sudo gem uninstall do_sqlite3
Successfully uninstalled do_sqlite3-0.9.10.1-x86-linux
You can’t perform that action at this time.