Skip to content

Instantly share code, notes, and snippets.

View theotherdon's full-sized avatar

Don Schrimsher theotherdon

View GitHub Profile
@theotherdon
theotherdon / render_methods.jsx
Created October 17, 2019 11:57
Render Functions in React
component Dog extends React.Component {
render() {
const { name } = this.props
return (
<div>
<h1>{name}</h1>
{this.renderPetMeButton()}
</div>
)
const mongoose = require('mongoose')
const Promise = require('bluebird')
mongoose.Promise = Promise
const mixinBulkWriteValidation = require('./mixinBulkWriteValidation')
mongoose.connect('mongodb://localhost/bulk_update_validation_test', { useMongoClient: true })
const connection = mongoose.connection
const Schema = mongoose.Schema
def inspect
inspection = column_names_with_inspectable_attributes.collect do |attr|
...implementation
end
...return inspection string
end
def column_names_with_inspectable_attributes
column_names.concat(additional_inspectable_attributes)
end
@theotherdon
theotherdon / site.yml
Created February 9, 2016 15:06
Sample Ansible playbook using environment variables.
---
- hosts: rails
remote_user: ubuntu
become: yes
become_user: root
vars:
secret_key_base: '{{ SECRET_KEY_BASE }}'
secret_token: '{{ SECRET_TOKEN }}'
db_username: '{{ DB_USERNAME }}'
@theotherdon
theotherdon / login_helper.rb
Created December 26, 2015 18:16
Login a User programatically with ng-token-auth.
def login_user_programatically
# User or whatever the name of the model is that you're trying to authenticate
@request.env['devise.mapping'] = Devise.mappings[:user]
@resource = FactoryGirl.create(:confirmed_user)
# The following two lines are where the magic happens.
@auth_headers = @resource.create_new_auth_token
@request.headers.merge!(@auth_headers)
end