Skip to content

Instantly share code, notes, and snippets.

View joshRpowell's full-sized avatar
🏠
Working from home

Josh Powell joshRpowell

🏠
Working from home
  • Fort Lauderdale, FL
View GitHub Profile
@joshRpowell
joshRpowell / table_to_csv.rb
Last active August 27, 2015 12:03 — forked from sandys/table_to_csv.rb
convert a html table to CSV using ruby
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb```
require 'rubygems'
require 'nokogiri'
require 'csv'
f = File.open("/tmp/preview.html")
doc = Nokogiri::HTML(f)
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true})
@joshRpowell
joshRpowell / spreadsheet-examples.rb
Created July 6, 2016 14:45 — forked from thebinarypenguin/spreadsheet-examples.rb
Read and write spreadsheets with ruby using the spreadsheet gem
# Read and write spreadsheets with ruby using the spreadsheet gem
# Full Docs: http://spreadsheet.rubyforge.org/GUIDE_txt.html
require 'spreadsheet'
# Open source spreadsheet
workbook = Spreadsheet.open 'source.xls'
# READ
@joshRpowell
joshRpowell / example.md
Created July 19, 2016 01:23 — forked from ericclemmons/example.md
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 <summary>Summary Goes Here</summary>
source 'https://rubygems.org'
ruby '2.3.1'
gem 'rails', '4.2.6'
gem 'spree', '~> 3.1.0'
gem 'spree_gateway', '~> 3.1.0'
@joshRpowell
joshRpowell / all.js
Created July 25, 2016 19:08
backend/all.js
//= require jquery2
//= require jquery_ujs
//= require spree/backend
//= require_tree .
@joshRpowell
joshRpowell / gist:020fddd3b80ada921b35d660125e52ff
Created July 29, 2016 18:30 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@joshRpowell
joshRpowell / Heroku Database.md
Created October 18, 2016 19:43 — forked from stevenyap/Heroku Database.md
Heroku for backup, exporting and importing database

Note: You need to have to Heroku PGBackup addon first heroku addons:add pgbackups..

Importing Heroku PG DB to local

Creates the backup on heroku first:

heroku pgbackups:capture
GIT
remote: https://github.com/InnovativeOperations/kiba.git
revision: 4ec2c0b35c2dacd575b9d518be0b79e9981baef1
branch: parsing-params
specs:
kiba (1.0.0)
GIT
remote: https://github.com/InnovativeOperations/spree_mail_settings.git
revision: 578dfaef402cfbf604930a149268389de85b515c
source 'https://rubygems.org'
ruby '2.3.3'
gem 'rails', '5.0.2'
gem 'mime-types', ['~> 2.6', '>= 2.6.1'], require: 'mime/types/columnar'
gem 'rollbar'
gem 'oj', '~> 2.12.14'
gem 'bourbon', '~> 4.2.0'
@joshRpowell
joshRpowell / markdown_helper.rb
Created May 16, 2017 14:01 — forked from erin-dot-io/markdown_helper.rb
Markdown helper & parser for Middleman apps
# I use this in conjunction with Contentful CMS to render blocks of markdown into my static middleman templates.
# In your gemfile, add Redcarpet:
gem 'redcarpet'
# ...and do a bundle install
# In your config.rb, add this line:
set :markdown_engine, :redcarpet