Skip to content

Instantly share code, notes, and snippets.

import React, { useContext } from "react"
import * as yup from "yup"
import WorkContext from "contexts/work_context"
import Link from "components/external_link"
import Form from "components/editable_area/components/form"
import NumberField from "components/editable_area/components/number_field"
import ProductIdsCheckboxField from "./form/product_ids_checkbox_field"
import OnixCodeField from "./form/onix_code_field"
{
"kind": "books#volumes",
"totalItems": 3218,
"items": [
{
"kind": "books#volume",
"id": "t0udCwAAQBAJ",
"etag": "SvMxvG5V10c",
"selfLink": "https://www.googleapis.com/books/v1/volumes/t0udCwAAQBAJ",
"volumeInfo": {
% Search for *} and replace with \section{}}
% Tag up chapters with \chapter{}, and \chapter*{} if you want to skip the numbering.
% Go through error notifications and resolve overflows with a forced hyphen or otherwise
% Spellcheck
% Commas and full stops outside quotation marks
% ’[.,]
% e.g. ‘It doesn’t sound like it to me’, she said.
% Commas and full stops outside quotation marks
% ’[.,]
% e.g. ‘It doesn’t sound like it to me’, she said.
% quotation marks the wrong way around
% (?!^([^’\r\n]++|’[^’\r\n]*’)*$)^.+
% e.g. ‘It doesn’t sound like it to me‘, she said.
% and for double quotes
% (?!^([^“”\r\n]++|“[^“”\r\n]*”)*$)^.+
DEPRECATION WARNING: The factory_girl gem is deprecated. Please upgrade to factory_bot. See https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md for further instructions. (called from <main> at /Users/Emma/rails/my_app/config/application.rb:16)
W, [2018-11-06T23:07:43.508902 #77737] WARN -- Skylight: [SKYLIGHT] [2.0.2] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
rails aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "onix_codes" does not exist
LINE 8: WHERE a.attrelid = '"onix_codes"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
c.collname, col_description(a.attrelid, a.attnum) AS comment
@EmmaB
EmmaB / poetry.rb
Last active September 21, 2018 13:47
Code is poetry
class Book
def initialize(name:, jacket: :draft)
@name = name
@jacket = jacket
end
def name
@name
end
# Use the Ruby JSON gem to parse data in the JSON format
json = JSON.parse(our_names)
# Get the first person's firstname. Ruby counts from 0, not 1!
json[0]["firstname"]
=> "Emma"
# Get the second person's firstname
json[1]["firstname"]
=> "David"
# Get each bit of the JSON data...
our_names = '[{"firstname": "Emma",
"lastname" : "Barnes"},
{"firstname": "David",
"lastname" :"Aldridge"},
{"firstname": "Rob",
"lastname" :"Jones"
}]'
my_name = '{ "firstname": "Emma" ,
"lastname" : "Barnes"
}'
@EmmaB
EmmaB / gist:de50c644f31396cdab47
Created March 19, 2015 10:41
ONIX to Word macro data
Dim strXPath1 As String 
strXPath1 = "/ONIXMessage/Product/ProductIdentifier[ProductIDType='03']/IDValue" 
ActiveDocument.ContentControls(1).XMLMapping.SetMapping strXPath1 
Dim strXPath2 As String 
strXPath2 = "/ONIXMessage/Product/BICMainSubject" 
ActiveDocument.ContentControls(2).XMLMapping.SetMapping strXPath2
 Dim strXPath3 As String
 strXPath3 = “/ONIXMessage/Product/Title[TitleType='01']/TitleText"