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>
@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
@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
@joshRpowell
joshRpowell / git-log-to-tsv.sh
Created June 26, 2017 14:22 — forked from pwenzel/git-log-to-tsv.sh
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@joshRpowell
joshRpowell / config.rb
Created December 4, 2017 15:15 — forked from javierarques/config.rb
Middleman 4 and Webpack 3 integration. Use Middleman with External Pipeline.
# ...
activate :external_pipeline,
name: :webpack,
command: build? ? "npm run build:assets" : "npm run start:assets",
source: ".tmp/webpack_output",
latency: 1
# ...
@joshRpowell
joshRpowell / docker-destroy-all.sh
Created December 21, 2017 22:43 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@joshRpowell
joshRpowell / Gemfile
Created June 26, 2020 22:43 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers