This file contains 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
# Function to create a new Heroku app instance using the ruby Heroku Platform API | |
# | |
# Documentation: | |
# https://devcenter.heroku.com/articles/setting-up-apps-using-the-heroku-platform-api | |
# https://devcenter.heroku.com/articles/platform-api-reference#app-setup | |
# https://github.com/heroku/platform-api | |
# https://heroku.github.io/platform-api | |
# | |
# Add the gem 'platform-api' | |
require "platform-api" |
This file contains 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 { fileURLToPath } from 'url'; | |
import { dirname } from 'path'; | |
console.log(`import.meta.url: ${import.meta.url}`); | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = dirname(__filename); | |
console.log(`dirname: ${__dirname}`); | |
console.log(`filename: ${__filename}`); |
This file contains 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 { captureException, flush } from '@sentry/nextjs'; | |
import NextErrorComponent from 'next/error'; | |
import type { ErrorProps } from 'next/error'; | |
import type { NextPage } from 'next'; | |
interface AppErrorProps extends ErrorProps { | |
err?: Error; | |
hasGetInitialPropsRun?: boolean; | |
} |
This file contains 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
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
failed=0 | |
for file in ${files}; do |
This file contains 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
module ImagesHelper | |
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags | |
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers. | |
# | |
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image' | |
# | |
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image"> | |
# | |
def image_set_tag(source, srcset = {}, options = {}) | |
srcset = srcset.map { |src, size| "#{path_to_image(src)} #{size}" }.join(', ') |