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 Liquid
module Tags
class ContactInquiryForm < Liquid::Tag
def self.helper_method(method)
end
def request_forgery_protection_token
:authenticity_token
end
@dpickett
dpickett / tmux_textaurant.sh
Created December 1, 2010 15:31
scripted way to start your work in a Rails project
export WORKING_DIR=~/work/textaurant
cd $WORKING_DIR; mvim; gitx
tmux start-server
tmux new-session -d -s Textaurant -n work
tmux new-window -tTextaurant:1 -n server
tmux new-window -tTextaurant:2 -n test
tmux send-keys -tTextaurant:0 'cd $WORKING_DIR' C-m
if Rails.env.production?
Braintree::Configuration.environment = Rails.env.staging? ? :sandbox : :production
Braintree::Configuration.merchant_id = ENV["braintree_merchant_id"]
Braintree::Configuration.public_key = ENV["braintree_public_key"]
Braintree::Configuration.private_key = ENV["braintree_private_key"]
else
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.merchant_id = "<super secret>"
Braintree::Configuration.public_key = "<super secret>"
Braintree::Configuration.private_key = "<super secret>"
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
})
},