Skip to content

Instantly share code, notes, and snippets.

View jonstuebe's full-sized avatar

Jon Stuebe jonstuebe

View GitHub Profile
@jonstuebe
jonstuebe / react-native-permission-plugin.js
Created December 30, 2023 16:58
Expo plugin for react-native-permissions
const {
withPlugins,
withDangerousMod,
withInfoPlist,
} = require("@expo/config-plugins");
const fs = require("fs");
const path = require("path");
async function readFileAsync(path) {
return fs.promises.readFile(path, "utf8");
@jonstuebe
jonstuebe / ReSocket.ts
Created December 22, 2023 15:33
A WebSocket class with reconnection support
class ReSocket {
private token: string | undefined;
private socket: WebSocket | undefined;
private listeners: boolean = false;
private currentAttempt: number = 0;
private backoffTime: number = 1000;
private maxAttempts: number = 30;
private timer: NodeJS.Timeout | undefined;
private messageFn: (data: any) => void = (data) => {
//
@jonstuebe
jonstuebe / themedStyle.ts
Created December 29, 2019 03:41
React Native styling support for StyleSheet.create
import { StyleSheet } from "react-native";
/*
Example: Normal Theme
-----------
const themes = {
default: {
colors: {
const postmanEnv = {
"id": "7a40704a-d4e2-4948-ba35-826a93f2bf0f",
"name": "local",
"values": [
// values would go here
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-04-23T18:36:01.716Z",
"_postman_exported_using": "Postman/7.0.9"
};
@jonstuebe
jonstuebe / express-scraper.js
Created February 23, 2019 17:28
Express Web Scraper
const express = require("express");
const Scaper = require("@jonstuebe/scraper");
const app = express();
const port = 3000;
app.get("/", async ({ query }, res) => {
if (!query.url) {
// handle error here
// res.status(500);
/*
Copyright 2017 Bryan Keller (https://github.com/widget-)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
#! /bin/bash
# Don't want to interpret variables whilst reading from the HEREDOC - thus the single quotes... potto
cat << 'EOF' >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://gist.githubusercontent.com/jonstuebe/bddadd625c0e8a66d430022ef652fc2a/raw/fe750d4886b593207ffa1331ad93a84200828812/slack-dark.css',
success: function(css) {
$("<style></style>").appendTo('head').html(css);
}
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@jonstuebe
jonstuebe / App.js
Last active February 21, 2017 16:36
Named Routes w/ React Router 4
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { BrowserRouter as Router } from 'react-router-dom';
import Link from './components/Link';
import { Routes } from './routes';
class App extends Component {
render() {
server {
listen 80;
server_name npm-test.dev;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;