Skip to content

Instantly share code, notes, and snippets.

View toyflish's full-sized avatar

Kai Rautenberg toyflish

View GitHub Profile
@monachilada
monachilada / gatsby-config.js
Last active October 16, 2020 19:03
Sample gatsby-config.js enabling live preview in Craft CMS
const { createHttpLink } = require('apollo-link-http');
const fetch = require('node-fetch');
const store = require('store');
const sourceNodes = require('gatsby/dist/utils/source-nodes');
require('dotenv').config();
const craftGqlUrl = process.env.CRAFT_GQL_URL;
const craftGqlToken = process.env.CRAFT_GQL_TOKEN;
module.exports = {
@ChrisLTD
ChrisLTD / webpack.config.js
Created May 21, 2017 23:31
ChrisLTD Craft CMS Webpack Build
const webpack = require('webpack');
// Let's us put the CSS in a separate file
const ExtractTextPlugin = require("extract-text-webpack-plugin");
// Minifies the JavaScript
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
// Cleans the build directory before each build
const CleanWebpackPlugin = require('clean-webpack-plugin');
@robinrendle
robinrendle / browsersync-webpack.md
Last active February 27, 2024 12:04
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@scottatron
scottatron / README.md
Created August 11, 2012 04:17
Lossless compression of images in Rails using Dragonfly & image_optim

This runs provides an .optim job for dragonfly and also adds the .optim job into .thumb

This requires you have the 'image_optim' gem and it's dependencies.

@ngs
ngs / gradient_support.rb
Created February 2, 2012 10:36
a patch to fix compass raising error when using 'transparent' keyword for gradiention: 'Expected a color. Got: transparent'
## If you are using under a rails project,
## I recommend to put this script onto config/initializer instead of applying the patch
module Compass::SassExtensions::Functions::GradientSupport
class ColorStop < Sass::Script::Literal
def initialize(color, stop = nil)
self.options = {}
if color.is_a?(Sass::Script::String) && color.value == 'transparent'
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")