Skip to content

Instantly share code, notes, and snippets.

View dpickett's full-sized avatar

Dan Pickett dpickett

View GitHub Profile
import { Prisma } from "../prisma.js";
import { DatabaseClient } from "../prisma/DatabaseClient.js";
export type IdType = string
export type CreateInput = Prisma.DiscoveryCallCreateInput
export type UpdateInput = Prisma.DiscoveryCallUpdateInput
export type WhereInput = Prisma.DiscoveryCallWhereInput
export type WhereUniqueInput = Prisma.DiscoveryCallWhereUniqueInput
export type OrderByInput = Prisma.DiscoveryCallOrderByWithRelationInput | Prisma.DiscoveryCallOrderByWithRelationInput[]
module MultitenantBehaviors
protected
def current_company
if request.subdomain && request.subdomain != 'www'
# assumes a `subdomain` string field on the Company class / table
@current_company ||= Company.find_by(subdomain: request.subdomain)
else
nil
end
end
@dpickett
dpickett / fetch-in-rails-config.md
Created April 26, 2018 20:49
Fetch in Rails Config

Fetch in Rails Config

Once Rails is probably configured in our Rails application, we are not out of the jungle yet. We will also need to properly configure our applications such that our fetch requests communicate effectively with Rails. Let's briefly touch on these:

Rails Options

Rails has built in securities and config that make it very selective about the requests that are allowed to come in. We'll need to edit our controller configuration to allow fetch requests and their json formats so that we can respond accordingly.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Weather</title>
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
require 'date'
class Officiant
def authorized?
is_minister_of_the_gospel? || willing_to_get_ordained_online?
end
def available?(date)
!not_really_interested && !busy?(date) && !generally_too_busy
end
let React = require('react')
let ReactDOM = require('react-dom')
var Hello = React.createClass({
getInitialState: function(){
return {
}
},
updateName: function(event){
this.setState({
var Hello = React.createClass({
getInitialState: function(){
return {
}
},
updateName: function(event){
this.setState({
name: event.target.value
})
},
require('babel-loader')
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
path: './src/main.js'
},
output: {
path: './build',
puts "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." +
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris"
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.