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
#!/bin/bash
cleanup() {
echo "destroy your machine"
fly m destroy --force
exit 0
}
trap 'cleanup' SIGINT
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
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 May 6, 2024 22:10
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 May 18, 2024 13:59
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