Skip to content

Instantly share code, notes, and snippets.

@cereallarceny
cereallarceny / index.js
Last active May 2, 2023 06:41
Server-side rendering in Create React App
const md5File = require('md5-file');
const path = require('path');
// CSS styles will be imported on load and that complicates matters... ignore those bad boys!
const ignoreStyles = require('ignore-styles');
const register = ignoreStyles.default;
// We also want to ignore all image requests
// When running locally these will load from a standard import
// When running on the server, we want to load via their hashed version in the build folder
@swalkinshaw
swalkinshaw / tutorial.md
Last active January 5, 2026 14:33
Designing a GraphQL API
@CodingDoug
CodingDoug / README.md
Last active August 8, 2025 20:09
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
import React from 'react';
const handleChange = (handler) => ({target: {files}}) =>
handler(files.length ? {file: files[0], name: files[0].name} : {});
export default ({
input: {onChange, onBlur, value: omitValue, ...inputProps},
meta: omitMeta,
...props
}) => (
@paramaggarwal
paramaggarwal / razzle.config.js
Created October 26, 2017 15:10
Razzle config with support for SASS (with source maps)
"use strict";
const autoprefixer = require("autoprefixer");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const Visualizer = require("webpack-visualizer-plugin");
module.exports = {
modify: (baseConfig, { target, dev }, webpack) => {
const appConfig = Object.assign({}, baseConfig);
@barbarj
barbarj / emacs_header_directions.md
Last active November 3, 2023 08:11
How to put 42 header in emacs
  1. Clone the repo from https://github.com/sullivanv/emacs
  2. Move all of the files from inside of that directory into ~/.emacs.d, including the hidden file .emacs
  3. If you don't have a ~/.emacs.d directory, create one.
  4. Navigate to ~/.emacs.d and rename .emacs to init.el
  5. Open emacs and C-c C-h
  6. You've got it!

How to fix the email in your header

  1. In your home directory, find, or create if needed, a file called .zshrc
  • If your not at 42, you'll likely not be using zshell, so the file should instead be .bashrc
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin