Skip to content

Instantly share code, notes, and snippets.

View jameswritescode's full-sized avatar
✍️

James Newton jameswritescode

✍️
View GitHub Profile
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Mutations::CreateOrganization, type: :graphql do
let(:query) do
<<~GQL
mutation($input: CreateOrganizationInput!) {
admin {
createOrganization(input: $input) {
"diagnostic-languageserver.linters": {
"rubocop": {
"args": [
"--format",
"quiet",
"--no-color",
"--force-exclusion",
"--stdin",
"%filename"
],
{
"calendar_months": [
{
"abbr_name": "Aug",
"day_names": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
nnoremap <silent> H :call <sid>tabline_control('tabN', 'bp')<cr>
nnoremap <silent> L :call <sid>tabline_control('tabn', 'bn')<cr>
function! s:tabline_control(tab_cmd, buf_cmd) abort
let a:tabnrs = []
tabdo call extend(a:tabnrs, [tabpagenr()])
exec len(a:tabnrs) > 1 ? a:tab_cmd : a:buf_cmd
endfunction
class Listing < ApplicationRecord
belongs_to :author, class_name: 'Person', inverse_of: :listings
end
class Person < ApplicationRecord
has_many :listings, foreign_key: 'author_id', inverse_of: :author
end
[4] pry(main)> Person.find('c-m9PWhIar54aabagq7ICb').listings.first.author;
Person Load (0.9ms) SELECT `people`.* FROM `people` WHERE `people`.`id` = '1' LIMIT 1
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
class << self
# implements would take a list of modules and verify that the model "implementing"
# defines the methods inside of the interface on itself
def implements(*interfaces)
interfaces_with_methods = interfaces.map do |interface|
[interface.name, interface.instance_methods(false)]
end
```javascript
like
this
and stuff
```
#!/bin/sh
failure_status=0
git_cmd() {
git diff --diff-filter=d --cached --name-only | grep -E $1
}
if_fail() {
if [ $? -ne 0 ]; then
const styles = {
submitButton: {
backgroundColor: '#33c567',
float: 'right',
fontWeight: 'bold',
margin: 0,
padding: [0, 30],
},
};
server {
listen [::]:80;
listen 80;
server_name ~^(?<sub>[\w\-]+)\.domainhere\.com$;
rewrite ^/en/(.*)$ $1 last;
return 301 $scheme://domainhere.com/$sub$request_uri;
}