Skip to content

Instantly share code, notes, and snippets.

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

Malachai malachaifrazier

🏠
Working from home
View GitHub Profile
@malachaifrazier
malachaifrazier / docker-destroy-all.sh
Created May 23, 2019 21:08 — 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)
@malachaifrazier
malachaifrazier / elasticsearch17.rb
Created May 1, 2019 04:59 — forked from rohitjangid/elasticsearch17.rb
Installing Elastic Search 1.7 via homebrew
# in the terminal run brew install elasticsearch1.7.rb
class Elasticsearch17 < Formula
desc "Distributed search & analytics engine"
homepage "https://www.elastic.co/products/elasticsearch"
url "https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.6.tar.gz"
sha256 "78affc30353730ec245dad1f17de242a4ad12cf808eaa87dd878e1ca10ed77df"
revision 1
bottle :unneeded
@malachaifrazier
malachaifrazier / install_elasticsearch_osx.md
Created April 10, 2019 02:38 — forked from djonsson/install_elasticsearch_osx.md
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@malachaifrazier
malachaifrazier / database_state_loader.rb
Created July 11, 2017 19:13 — forked from keithpitt/database_state_loader.rb
Note that this code only works with PostgreSQL, but it wouldn’t be too hard to adapt our approach for other relational databases.
# Add to `spec/support/database_state_loader.rb`
class DatabaseStateLoader
class EnvironmentError < RuntimeError; end
def self.load(path)
new(path).load
end
def initialize(path)
@malachaifrazier
malachaifrazier / rails-postgres-backbone-bootstrap-bootswatch
Created June 27, 2017 03:42 — forked from sionc/rails-postgres-backbone-bootstrap-bootswatch
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
#!/bin/bash
#!/usr/local/bin/python
"""
To use this script, you must be in the root directory of a Rails project that
is using git. You should also make sure that your directory does not contain any
uncommitted changes. Then run:
$ python rails_switch_branch.py name_of_another_branch
Running the above will do the following:

Getting Balanced Payments up and running.

Files

  • balanced_controller.rb
  • _bank_account_form.html.haml
  • _credit_card_form.html.haml
  • bank_account_submission.js
  • credit_card_submission.js
# Run with: rake environment elasticsearch:reindex
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klass = Place
ENV['CLASS'] = klass.name
ENV['INDEX'] = new_index = klass.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')