Skip to content

Instantly share code, notes, and snippets.

View ivanoats's full-sized avatar
💭
🤙 Stoked 🏄‍♂️

Ivan Storck ivanoats

💭
🤙 Stoked 🏄‍♂️
View GitHub Profile
@ivanoats
ivanoats / migrator.js
Created July 7, 2016 17:42
createImage on Contentful.com
async function createImage (image, space) {
try {
const result = await space.createAsset({
sys: {
createdAt: image.created_at,
updatedAt: image.updated_at,
},
fields: {
title: { 'en-US': image.title },
file: {
@ivanoats
ivanoats / gatsby-node.js
Created July 5, 2016 21:22
gatsby config
export function modifyWebpackConfig (config) {
// arrow-body-style rule doesn't recognize that the spread operator needs
// to be in an object literal
// eslint-disable-next-line arrow-body-style
config.loader('jpg', (cfg) => {
return {
...cfg,
test: /\.jpe?g$/i,
loader: 'file-loader?name=images/[name].[ext]',
}
@ivanoats
ivanoats / useful-atom-packages.sh
Created June 24, 2016 18:41
Useful Atom packages
#!/bin/bash
apm install atom-ternjs
apm install autocomplete-modules
apm install utocomplete-paths
apm install autocomplete-ruby
apm install autocomplete-sass
apm install build
apm install emmet
apm install file-icons
apm install gist-it
@ivanoats
ivanoats / gatsby-node-assign.js
Last active June 21, 2016 04:56
two versions, one based on README and another based on removing eslint warnings
export function modifyWebpackConfig (config) {
// Object.assign is not picked up as mutation by immutable linter ?!
config.loader('jpg', (cfg) => Object.assign(
cfg,
{
test: /\.jpe?g$|\.gif$|\.png$/i,
loader: 'file-loader?name=images/[name].[ext]',
}
))
return config
@ivanoats
ivanoats / gatsby-node.js
Created June 18, 2016 20:38
gatsby-node.js
// eslint-disable-next-line immutable/no-mutation,no-unused-vars
exports.modifyWebpackConfig = function (config, env) {
config.removeLoader('json')
config.loader('json', (cfg) => {
// eslint-disable-next-line immutable/no-mutation,no-param-reassign
cfg.test = /\.json/
// eslint-disable-next-line immutable/no-mutation,no-param-reassign
cfg.loaders= ['markdown', 'json']
return cfg
})
@ivanoats
ivanoats / fetch-from-contentful.js
Created June 17, 2016 18:45
fetch-from-contentful.js
#!/usr/bin/env babel-node
require('dotenv').config()
import contentful from 'contentful'
import fs from 'fs-extra-promise'
// Contentful Config
const apiToken = process.env.CONTENTFUL_DELIVERY_API_TOKEN
const spaceId = process.env.CONTENTFUL_SPACE_ID
const client = contentful.createClient({ accessToken: apiToken, space: spaceId })
@ivanoats
ivanoats / post.json
Created June 17, 2016 00:25
contentful JSON example
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "changeme"
}
},
"id": "changeme",
cabal: Entering directory '/var/folders/85/c3khd5g15nq5yy8_1m0s40y00000gn/T/cabal-tmp-26301/herbalizer-0.4.9'
Configuring herbalizer-0.4.9...
Building herbalizer-0.4.9...
Preprocessing executable 'herbalizer' for herbalizer-0.4.9...
[1 of 1] Compiling Main ( src/Main.hs, dist/build/herbalizer/herbalizer-tmp/Main.o )
src/Main.hs:152:5: error:
• Non type-variable argument in the constraint: Stream s m Char
(Use FlexibleContexts to permit this)
• When checking the inferred type
@ivanoats
ivanoats / ghcPkgUtils.sh
Created June 3, 2016 18:51 — forked from timmytofu/ghcPkgUtils.sh
ghc-pkg-clean and ghc-pkg-reset compatible with both zsh and bash
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@ivanoats
ivanoats / gatsby-node.js
Created May 25, 2016 16:57
gatsby-node.js
const fs = require('fs-extra')
exports.postBuild = function ign (pages, callback) {
console.log('in IGN!')
const file = 'testing'
fs.outputFile(file, 'works', (err) => {
console.log(err)
})
callback()
}