Skip to content

Instantly share code, notes, and snippets.

Avatar

Mars Hall mars

View GitHub Profile
@mars
mars / create-react-app-on-heroku.sh
Created Jul 29, 2016
Create a React app & deploy to Heroku
View create-react-app-on-heroku.sh
## Global install of the app generator
npm install -g create-react-app
## Setup the app (first-time only)
create-react-app my-app
cd my-app
git init
# Create the Heroku app; requires free account at https://www.heroku.com/
heroku create -b https://github.com/heroku/heroku-buildpack-static.git
@mars
mars / install.md
Last active Dec 19, 2019 — forked from Micka33/install.md
Cassandra on Mac OS X
View install.md

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@mars
mars / register_chrome_with_window_size.rb
Created Oct 13, 2013
Set window size for Capybara/Selenium/chromedriver
View register_chrome_with_window_size.rb
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: {
"chromeOptions" => {
"args" => %w{ window-size=1024,768 }
}
}
)
end
View terraform-kong-1.0-plugin-fail.txt
TF_LOG=DEBUG terraform apply -var name=kong-micro -var heroku_team=micro
2019/01/09 13:33:13 [INFO] Terraform version: 0.11.8 7a5c1d221ac209bbac66947c369815cd9ca70ed5
2019/01/09 13:33:13 [INFO] Go runtime version: go1.10.1
2019/01/09 13:33:13 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply", "-var", "name=kong-micro", "-var", "heroku_team=micro"}
2019/01/09 13:33:13 [DEBUG] Attempting to open CLI config file: /Users/mars.hall/.terraformrc
2019/01/09 13:33:13 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/01/09 13:33:13 [INFO] CLI command args: []string{"apply", "-var", "name=kong-micro", "-var", "heroku_team=micro"}
2019/01/09 13:33:13 [INFO] command: empty terraform config, returning nil
2019/01/09 13:33:13 [DEBUG] command: no data state file found for backend config
2019/01/09 13:33:13 [DEBUG] New state was assigned lineage "8d0b558a-e40c-305b-1f1a-63b95bfc7630"
@mars
mars / .bash_profile
Last active Oct 22, 2018
bash prompt git status
View .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
function parse_git_dirty {
git diff --quiet || echo ""
}
function parse_git_branch {
e=`echo $( { git status; } 2>&1 ) | tr '[:upper:]' '[:lower:]'`
if [[ ! $e =~ 'not a git repository' ]]
then git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)] /"
fi
@mars
mars / foo.rb
Created Jun 27, 2018 — forked from mtsmfm/foo.rb
convert from json hyper schema to swagger spec
View foo.rb
require 'yaml'
require 'pathname'
require 'active_support/all'
def convert(f)
filename = Pathname.new(f)
yaml = YAML.load_file(filename)
name = filename.basename('.yml').to_s
File.write(filename, {
@mars
mars / reactjs-filepicker.js
Last active Mar 8, 2018
Use Filepicker.io with React.js (v0.14, ES2015, & JSX)
View reactjs-filepicker.js
/*
Filepicker lib must be loaded from script tag in HTML:
<script type="text/javascript" src="//api.filepicker.io/v2/filepicker.js"></script>
*/
class FilepickerInput extends React.Component {
componentDidMount() {
const filepickerElement = this.refs.filepicker;
if (typeof filepicker !== 'undefined') {
// Single-page app integration: https://developers.filepicker.com/docs/support/integration/117
@mars
mars / development.js
Last active May 11, 2017
Webpack config to support environment variables in JS source
View development.js
module.exports = {
WEBPACK_ENV: JSON.stringify('development'),
FOO: JSON.stringify('per-environment foo value')
};
@mars
mars / rewire-module.js
Last active Sep 15, 2016
Manually mock React components; Jasmine helper to stub & teardown a bunch of a module's dependencies with Rewire. How-to: http://substantial.com/blog/2014/11/11/test-driven-react-how-to-manually-mock-components/
View rewire-module.js
/*
Jasmine helper to stub & teardown a bunch of a module's dependencies.
describe("SomeModule", function() {
var SomeModule = rewire("some-module");
rewireModule(SomeComponent, {
ItsComponent: React.createFactory('div'),
AnotherComponent: React.createFactory('div')
@mars
mars / heroku-buildpack-tips.markdown
Created Aug 9, 2016
Tips for authoring Heroku buildpacks
View heroku-buildpack-tips.markdown
You can’t perform that action at this time.