Skip to content

Instantly share code, notes, and snippets.

Josh Rehman javajosh

Block or report user

Report or block javajosh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@javajosh
javajosh / README.md
Last active Mar 14, 2019
An experiment with
View README.md

This is a SCRIPT-8 cassette. This is a revision. This is another revision.

@javajosh
javajosh / background.js
Last active Feb 26, 2018
Chrome extension that fails to adjust HTTP status line code.
View background.js
let count = 0;
function listener1(details){
return {cancel: true};
}
function listener2(details){
console.log(count++, details);
if (!details) return;
for (let i = 0; i < details.responseHeaders.length; i++){
if (details.responseHeaders[i].name === 'status'){
View chrome_ideas.txt
1. Add a common code cache. Save parsed js libraries locally; also other resources.
Detail: Chrome should detect common subresource requests and satisfy them with local copies. This puts (good) pressure on devs to
*stop bundling code*. I'd like to see a special page in chrome (e.g. chrome://codecache) that lists out all the
subresources I currently have. Ideally, the JS resources would be stored in a clonable pre-parsed state, and optionally
make them immutable. The same could be applied to CSS, images, and fonts. Over time my Chrome instance would accrete a
list of resources, and get faster and faster. Combine with subresource integrity, or implement more losely (does it really
matter what version of jQuery this site needs? Probably not.) Another nice feature of this is we'd be able to use the
unminified code without a performance hit improving idea- and technique-sharing. The tradeoff is risk of breakage.
This can be prototyped with a browser extension.
View checklist.md

First boot Accept defaults. Sign-in to wifi Don't give apple ID (don't want itunes or icloud)

Dock autohide, move left, remove most things. Privacy Turn on firewall, Turn off location services, turn off diagnostics to apple, turn off crash data to devs Display

@javajosh
javajosh / pom.xml
Created Oct 27, 2017
A nice starter POM.
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.javajosh</groupId>
<artifactId>Hello</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
View Substrings.java
import java.io.*;
import java.util.*;
public class Substrings {
static boolean DEBUG = false;
static Set<String> substrings(String source){
Set<String> substrings = new TreeSet<>();
for (int i = 0; i < source.length(); i++) {
for (int j = i + 1; j <= source.length(); j++) {
View BinaryTree.java
import java.util.*;
/**
* Construct a tree like this one:
* <pre>
* 1
* / \
* 2 3
* / \ \
* 4 5 6
View TreeThinking.txt
** Visualizing Binary Trees in ASCII **
1 Let's try something different. The left child goes to the right.
/ \
2 3 <--- No room for 3.left 1 2 4 7
/ \ \ 3 9
4 5 6 5 <-- The oddness is here because we had to skip a row.
/ \ 6 But there is no ambiguity!
7 8 <--- Width totally determined by leaves! 8
You can’t perform that action at this time.