Skip to content

Instantly share code, notes, and snippets.

@nhemsley
nhemsley / rollup.config.js
Created February 3, 2022 01:02 — forked from geotrev/rollup.config.js
Jekyll Rollup Config
import { terser } from "rollup-plugin-terser"
import path from "path"
import resolve from "rollup-plugin-node-resolve"
import babel from "rollup-plugin-babel"
import glob from "glob"
const scriptPattern = path.resolve(__dirname, "_scripts/**/!(_)*.js")
const inputs = glob.sync(scriptPattern).reduce((files, input) => {
const parts = input.split("/")
namespace :db do
task :backup do
path = dump_path(Time.now)
puts "Backup to #{path}"
system "pg_dump -Fc --no-owner --dbname=#{db_name} > #{path}"
end
task :load, :file, :options do |t, args|
@nhemsley
nhemsley / Rakefile
Created October 13, 2019 03:16 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@nhemsley
nhemsley / Rakefile
Created October 13, 2019 03:16 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@nhemsley
nhemsley / database.yml
Created February 19, 2019 11:11 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
default: &default
adapter: postgresql
encoding: unicode
username: postgres
password:
pool: 5
host: db
production:
---
BUNDLE_PATH: .bundle
BUNDLE_BIN: ./bin
@nhemsley
nhemsley / flat directory
Last active August 29, 2015 13:56
resize all files in a directory to output/
for file in *.jpg
do
echo "Converting $file"
convert $file -resize 800x output/$file
done
SETUP
#You must install ruby v1.8.7, using rbenv & rbenv install or rvm
#you can find out with ruby -v
#You must install mysql
gem install -v=2.0.1 rails
gem install -v=2.4.2 rdoc
@nhemsley
nhemsley / Gemfile
Last active August 29, 2015 13:56
Middleman proxying rack middleware
gem 'rack-proxy', git: 'https://github.com/nhemsley/rack-proxy.git'
@nhemsley
nhemsley / rails_proxy.rb
Created February 24, 2014 06:44
Middleman proxying rack middleware
require 'rack-proxy'
require 'pry'
class Rack::RailsProxy < Rack::Proxy
def initialize(app)
@app = app
end
def call(env)