Skip to content

Instantly share code, notes, and snippets.

View shortdiv's full-sized avatar
🚧
Always a WIP

Divya shortdiv

🚧
Always a WIP
  • us-central1
View GitHub Profile
@IanColdwater
IanColdwater / twittermute.txt
Last active March 6, 2024 18:49
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet

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.
@kentcdodds
kentcdodds / provider-pattern.js
Last active September 18, 2018 23:37
A Render Prop by Any Other Name: React
const {Provider, Consumer: ThemeConsumer} = React.createContext()
class ThemeProvider extends React.Component {
setTheme = theme => this.setState({theme})
state = {theme: 'dark', setTheme: this.setTheme}
render() {
return <Provider value={this.state} {...this.props} />
}
}
@greenbrian
greenbrian / HashiCorp Vault - methods of writing ACL policies
Last active May 20, 2022 02:10
HashiCorp Vault - methods of writing ACL policies
There are many methods for writing Vault policies.
This gist was created to collect the most common methods
such that they can be easily used as references for syntax,
as well as evaluation for which method suits a particular purpose.
TODO:
- Add complex policy examples
- Add @json.file examples
@coderek
coderek / index.html
Last active March 26, 2018 02:48
Vue 2.0 - 2 way data binding deeper analysis
<!DOCTYPE html>
<html>
<head>
<title>Test 2 way data binding</title>
</head>
<body>
<div id="app">{{ abc }} - {{ def }} = {{ abc-def }} </div>
<button id='add'>add</button>
<button id='double'>double</button>
<script src='main.js'></script>
@Rich-Harris
Rich-Harris / service-workers.md
Last active March 28, 2024 23:58
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@ygotthilf
ygotthilf / jwtRS256.sh
Last active March 25, 2024 09:12
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@raineorshine
raineorshine / _chrome-ext-auth-identity.md
Last active November 10, 2023 23:57
How to set up user authentication for a Chrome Extension using the Chrome Identity API

How to set up user authentication for a Chrome Extension using the Chrome Identity API

  1. Create a private key file, from which you can create the manifest key and Application ID, as detailed here: https://stackoverflow.com/questions/23873623/obtaining-chrome-extension-id-for-development
  2. Add the manifest key to "key" in manifest.json
  3. Create a new project in Google Developer Console https://console.developers.google.com/project
  4. Go to "APIs & auth > Credentials" and create new client id for a Chrome Application using the Application ID generated in step 3.
  5. Copy the Client ID to oauth2.client_id in the manifest.json

Deprecated?