This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import slugify from "slugify"; | |
export const slugifyText = str => | |
slugify(str, { replacement: "-", lower: true, remove: /[$*_+~.()'"!\-:@]/g }); | |
export const uniqueArray = originalArray => [...new Set(originalArray)]; | |
export const getPostsFromTag = (posts, tag) => | |
posts.filter(post => post.tags.map(tag => slugifyText(tag)).includes(tag)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replaces hyphens with spaces. (only hyphens between word chars) | |
*/ | |
function unhyphenate(str){ | |
return str.replace(/(\w)(-)(\w)/g, '$1 $3'); | |
} | |
export const toTitleCase = function (str) { | |
str = str.toLowerCase().split(' '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getParams = function (url) { | |
var params = {}; | |
var parser = document.createElement('a'); | |
parser.href = url; | |
var query = parser.search.substring(1); | |
var vars = query.split('&'); | |
for (var i = 0; i < vars.length; i++) { | |
var pair = vars[i].split('='); | |
params[pair[0]] = decodeURIComponent(pair[1]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-12-17T01:18:41.248Z","extensionVersion":"v3.4.3"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached dir1 dir2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clone the repo | |
git clone --depth=1 git://someserver/somerepo dirformynewrepo | |
// Remove the .git directory | |
rm -rf !$/.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add to .gitignore file | |
node_modules | |
Then call: | |
git rm -r --cached node_modules | |
git commit -m "Remove node_modules now that they're ignored!" | |
git push origin master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import { HttpLink } from 'apollo-link-http' | |
// import { InMemoryCache } from 'apollo-cache-inmemory' | |
import { ApolloLink } from 'apollo-link' | |
import { HttpLink } from 'apollo-link-http' | |
import { InMemoryCache } from 'apollo-cache-inmemory' | |
const GRAPHCMS_API = 'https://api.graphcms.com/simple/v1/myBlog' | |
export default (ctx) => { | |
const httpLink = new HttpLink({ uri: GRAPHCMS_API }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
allPosts { | |
title | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The file to target to know what gist you are retrieving |