Skip to content

Instantly share code, notes, and snippets.

request headers in ios:
GET /graphql
Accept: */*
Content-Type: application/json
Origin: https://prismic-graphql-pagination.netlify.app
Referer: https://prismic-graphql-pagination.netlify.app/all-posts
User-Agent: Mozilla/5.0 (iPad; CPU OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1
Prismic-ref: XuDzRxAAACMAedKh
const getAllPages = (allData, endCursor) =>
getPage(endCursor)
.then(response => {
if (response.pageInfo.hasNextPage) {
return getAllPages(response.edges, response.edges.cursor)
.then(nextPage => allData.push(nextPage))
} else {
return allData
}
})
@faresd
faresd / prismic-php-website-starter
Last active January 30, 2020 16:58
Run Prismic PHP Website starter on windows 10
install XAMPP
https://www.apachefriends.org/index.html
install composer
https://getcomposer.org/download/
run composer in project root
php composer.phar install
# In case of 'unlisted' target, only passing 'publishTarget' as a request header works
if [[ ${PUBLISH_TARGET} == 'unlisted' ]]; then
HTTP_CODE=$(curl \
-w %{http_code} \
-o api-response.json \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-H "publishTarget: $PUBLISH_TARGET" \
-X POST \
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "beta-dot-ao-docs-staging.appspot.com"
},
"host": "beta-dot-ao-docs-staging.appspot.com",
"basePath": "/_ah/api",
"schemes": [
"https"
@faresd
faresd / sdf
Created October 10, 2017 14:37
sdfsdf
@faresd
faresd / pages-query.js
Created November 23, 2015 15:36
Pages query
app.route('/:uid').get(function(req, res){
var uid = req.params['uid']
var p = prismic.withContext(req, res);
p.getByUID('page', uid, function(err, page) {
if(err) {
res.status(500)
.send("Error 500: " + err.message);
}
if(!page) {
@faresd
faresd / page-for-documentation.json
Created November 23, 2015 15:24
Page Custom Type for documentation
{
"Content" : {
"body" : {
"fieldset" : "Dynamic page zone...",
"type" : "Slices",
"config" : {
"choices" : {
"featured-items" : {
"type" : "Group",
"fieldset" : "Featured items",
@faresd
faresd / post-documentation.json
Created November 20, 2015 15:18
Post custom type for documentation
{
"Blog Post" : {
"uid" : {
"type" : "UID",
"config" : {
"placeholder" : "unique-identifier-for-blog-post-url"
}
},
"body" : {
"fieldset" : "Post content",
@faresd
faresd / page.json
Created November 10, 2015 10:31
Page
{
"Content" : {
"body" : {
"fieldset" : "Dynamic page zone...",
"type" : "Slices",
"config" : {
"choices" : {
"alternated-highlights" : {
"type" : "Group",
"fieldset" : "Alternated highlights",