Skip to content

Instantly share code, notes, and snippets.

@narajaon
narajaon / build.sh
Last active February 6, 2020 22:27
build.sh
#!/usr/local/bin/bash
# /!\ make sure to use the latest version of bash
if [ -z "$1" ]; then
echo "usage: ./build <dir name>"
exit 1
fi
declare ROOT_DIR="/Users/fabienrajao/Documents/freelance/zephyr"
declare PACK_DIR="$ROOT_DIR/packages"
declare -a commands=("next" "relay")
@mavaddat
mavaddat / QuantcastChoice.html
Last active July 3, 2020 04:06
Obtain and manage consumer consent for GDPR across digital ecosystem with Quantcast Choice. Details here: https://help.quantcast.com/hc/en-us/articles/360047075914-Choice-Universal-Tag-Implementation
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->
<script type="text/javascript" async="true">
(function() {
var host = window.location.hostname;
var element = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
var milliseconds = new Date().getTime();
var url = 'https://quantcast.mgr.consensu.org'
.concat('/choice/', 'DffhEACkSgqrA', '/', host, '/choice.js')
.concat('?timestamp=', milliseconds);

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 16, 2024 14:13
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@clementgarbay
clementgarbay / setup-guide.md
Last active March 26, 2019 17:11
Growth.Dev - Setup Guide

[Growth.Dev] How to transform Linkedin into an address book using Puppeteer!

Prerequisites 🛠

  • A command line terminal, if you're not familiar with it you can read this post explaining the basics. For the best experience, we recommend you iTerm2 an alternative to the pre-install macOS terminal.

  • The JavaScript runtime Node.js. If you're a brew user you can simply brew install node, otherwise you can download it here. Moreover here's an article where you can find more information about how to install it and use it.

To be sure both of these tools are OK, open a terminal and run:

@rstacruz
rstacruz / README.md
Last active January 17, 2024 22:27
Setting up Babel and TypeScript

Install Babel 7 and TypeScript

yarn add --dev \
  @babel/core \
  @babel/cli \
  @babel/preset-env \
  @babel/preset-typescript \
  typescript
@mcdougal
mcdougal / _error.js
Created September 28, 2018 11:53
Using @sentry/browser with Next.js for client and server-side rendering
import * as Sentry from '@sentry/browser';
import getConfig from 'next/config';
import React from 'react';
const { SENTRY_DSN } = getConfig().publicRuntimeConfig;
Sentry.init({ dsn: SENTRY_DSN });
/**
* Send an error event to Sentry.
@DavidWells
DavidWells / netlify.toml
Last active February 7, 2024 08:50
All Netlify.toml & yml values
[Settings]
ID = "Your_Site_ID"
# Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts.
[build]
# This is the directory to change to before starting a build.
base = "project/"
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root.
# This is the directory that you are publishing from (relative to root of your repo)
@maysamsh
maysamsh / UISearchBar+Ext.swift
Last active March 14, 2022 01:07
A small extension for UISearchBar which shows an UIActivityIndicator while searching
//
// UISearchBar+Ext.swift
// frazeit
//
// Created by Maysam Shahsavari on 7/30/18.
// Updated on 9/26/19.
// Copyright © 2018 Maysam Shahsavari. All rights reserved.
// Updated: 10/02/2020.
import Foundation