Skip to content

Instantly share code, notes, and snippets.

View dylanjha's full-sized avatar

Dylan Jhaveri dylanjha

  • Mux
  • San Francisco
View GitHub Profile

Inconsistent uri encoding with parenthesis. Notice in the first 3 examples the parenthesis are still there, in the fourth example the parenthesis are replaced with %28 and %29:

This is the string being encoded in each example: www.google.com?q=some string with (parens)

===

Javascript (node 6.9.0):

encodeURI("www.google.com?q=some string with (parens)")
@dylanjha
dylanjha / airports.json
Created December 26, 2018 23:38 — forked from tdreyno/airports.json
JSON data for airports and their locations
This file has been truncated, but you can view the full file.
[
{
"code": "AAA",
"lat": "-17.3595",
"lon": "-145.494",
"name": "Anaa Airport",
"city": "Anaa",
"state": "Tuamotu-Gambier",
"country": "French Polynesia",
"woeid": "12512819",
@dylanjha
dylanjha / test.html.erb
Created March 22, 2015 03:21
Rake task to load erb
<%# Put this file in app/views/test.html.erb %>
<h1>Here is some html</h2>
<%= name %>

Keybase proof

I hereby claim:

  • I am dylanjha on github.
  • I am dylanj (https://keybase.io/dylanj) on keybase.
  • I have a public key ASCL1W5WGRpMp0XKfIrTOB6SUQYlzB35MH3D6zVR5tLbmAo

To claim this, I am signing this object:

@dylanjha
dylanjha / 0. sprockets_depend_on_config.rb
Last active May 11, 2020 15:11
Adds Sprockets Directive `depend_on_config`. I'm using this to load .yml locale translations on the server into the client in json
=begin
Useage:
#assets/locales/en.js.erb
```js
//= depend_on_config 'locales/es.yml'
```
=end
@dylanjha
dylanjha / gatsby-config.js
Last active January 12, 2021 06:04 — forked from ajmalafif/gatsby-config.js
single rss.xml from 2 sources (MDX & Sanity.io)
// Load variables from `.env` as soon as possible
require('dotenv').config({
path: `.env.${process.env.NODE_ENV || 'development'}`
})
const clientConfig = require('./client-config')
const isProd = process.env.NODE_ENV === 'production'
// Portable Text Serialization
const PortableText = require("@sanity/block-content-to-html")
@dylanjha
dylanjha / script.js
Created July 16, 2013 23:21
a little javascript flash message. see demo at: http://jsfiddle.net/dylanjha/kca9p/
<div id='nav'>
<ul class='nav-list'>
<li class='nav-item'><a href="javascript://">Home</a></li>
<li class='nav-item'><a href="javascript://">There</a></li>
</ul>
</div>
<div id='flash-container' class='flash-container'>
</div>
<div id='content'>
Here is some content.
@dylanjha
dylanjha / airplay-button.jsx
Last active December 17, 2021 17:17
React airplay control for media-chrome
const ButtonPressedKeys = ['Enter', ' '];
const AirPlayButton = ({ onClick }) => {
const onKeyPress = (evt) => {
const { key } = evt;
if (!ButtonPressedKeys.includes(key)) return;
onClick(evt);
};
return (
<div