Skip to content

Instantly share code, notes, and snippets.

@JeremiahChurch
JeremiahChurch / app-lib-subdomain_constraint.rb
Last active November 11, 2022 00:15
Custom Subdomains from Models in Rails & Rspec testing too
class SubdomainConstraint
# used in routes to generate subdomains
# note there is a cache buster in company.rb in case the subdomain is updated - `reload_routes`
# update it if we write any additional cache entries here
RESERVED_SUB_DOMAINS = %w[
www app admin test staging help support wwww cdn owner media intercom mail r _domainkey blog webhooks webhook
hooks api api-test api-staging referral outbound mail webmail w3 mailboxes io heroku inbound google search
].freeze
<html>
<head>
<style type='text/css'>
body, html {
margin: 0;
padding: 0;
}
body {
color: black;
display: table;
@bbugh
bbugh / apollo.js
Last active August 11, 2022 07:42
Apollo Action Cable setup
import { ApolloClient } from 'apollo-client'
import { split } from 'apollo-link'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { getMainDefinition } from 'apollo-utilities'
import { createPersistedQueryLink } from 'apollo-link-persisted-queries'
import { setContext } from 'apollo-link-context'
// AC: IMPORT ACTIONCABLE
import ActionCable from 'actioncable'
@MatteoJoliveau
MatteoJoliveau / pageable_type.rb
Created June 21, 2018 07:30
Pageable interface to paginate with Kaminari in GraphQL Ruby
module Types
module PageableType
include Types::Base::Interface
field :current_page, Integer, null: true
field :previous_page, Integer, null: true, method: :prev_page
field :next_page, Integer, null: true
field :total_pages, Integer, null: true
field :total_items, Integer, null: true, method: :total_count
field :size, Integer, null: true, method: :count
field :first_page, Boolean, null: true, method: :first_page?
@ayamomiji
ayamomiji / list.html
Last active September 18, 2023 16:13
Stimulus example: smart scroll
<div data-controller="smart-scroll"
data-action="smart-scroll:added->smart-scroll#handleAdded
resize->smart-scroll#handleAdded
scroll->smart-scroll#handleScroll">
<div data-controller="smart-scroll-item">
aya: an an
</div>
<div data-controller="smart-scroll-item">
hatate: ni hao
</div>
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@saqueib
saqueib / errorHandler.js
Last active June 9, 2022 06:42
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
import axios from 'axios'
import toast from './toast'
function errorResponseHandler(error) {
// check for errorHandle config
if( error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false ) {
return Promise.reject(error);
}
// if has response show the error
@a7madgamal
a7madgamal / dark.md
Last active July 14, 2023 04:00
Dark mode for Slack on MacOS
@davidwessman
davidwessman / .circleci-config.yml
Created August 13, 2017 14:54
CircleCI 2.0 setup
version: 2
jobs:
build:
working_directory: ~/mowers
docker:
- image: circleci/ruby:2.4.1-node
environment:
PGHOST: 127.0.0.1
PGUSER: mower
RAILS_ENV: test