Skip to content

Instantly share code, notes, and snippets.

View niikkiin's full-sized avatar
👀
Going above and beyond

Nikki Abarca niikkiin

👀
Going above and beyond
View GitHub Profile
@sladg
sladg / useReptchaEnterpise.ts
Last active May 31, 2024 17:48
No-dependency implementation of Google's Recaptcha Enterprise.
<!--
// inside _app.tsx
import Script from 'next/script';
// inside custom App component.
<Script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" />
-->
import { useEffect, useState } from 'react';

To embed the contents of an SVG file into your site using NextJS 12 with the new Rust-based compiler, perform the following steps:

  1. Install @svg/webpack:
$ npm install --save-dev @svgr/webpack
  1. Create a svgr.config.js config file with the following contents. This will remove the width and height from the SVG but keep the viewBox for correct scaling.
@alukach
alukach / app.yaml
Last active July 10, 2024 05:08
An example Github Actions for Python + Pipenv + Postgres + Pyright
# .github/workflows/app.yaml
name: My Python Project
on: push
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
@dphilipson
dphilipson / react-typescript-setup.md
Last active January 11, 2024 16:12
React/TypeScript setup notes

React/TypeScript setup steps

Setting up the environment

  • Run
    yarn create react-app my-app --typescript
    cd my-app
    
@bradtraversy
bradtraversy / docker-help.md
Last active July 9, 2024 10:18
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@faisalmahmud
faisalmahmud / .eslintrc.js
Last active April 1, 2021 14:02
Template for .eslintrc.js, .prettierrc.js, settings.json in VS Code
module.exports = {
parser: "babel-eslint",
plugins: ["react", "prettier"],
rules: {
"prettier/prettier": "error"
},
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true
@remy
remy / ActiveLink.js
Last active April 12, 2024 08:33
Next.js version of `activeClassName` support.
@granmoe
granmoe / __responsive styled components
Last active January 6, 2021 02:22
Programmatically create responsive styled components with react and styled-components
// this file is just here to change the name of the gist
import React from 'react'
import styled from 'styled-components'
const makeResponsiveComponent = (rulesets, tagName = 'div') =>
styled(tagName)`${buildStyles(rulesets)}`
const buildStyles = rulesets =>
rulesets.reduce(
(cssString, { constraint, width, rules }) =>
@moodysalem
moodysalem / PreventLeaveRoute.jsx
Created January 22, 2017 18:52
React HOC to prevent leaving a page
import React, { Component, PropTypes } from 'react';
/**
* Only ever render one of these per page
*
* TODO: improve with react-side-effect to better handle multiple instances of this being rendered at once so we can
* nest the component in forms
*/
export default class PreventLeaveRoute extends Component {
static contextTypes = {