Skip to content

Instantly share code, notes, and snippets.

View martinwheeler's full-sized avatar

Martin Wheeler martinwheeler

View GitHub Profile
@martinwheeler
martinwheeler / target_blank.js
Last active September 8, 2016 09:11
Add target _blank to all URLs which are external
jQuery('a').each(function() {
var url = jQuery(this).attr('href');
var httpRegex = new RegExp('https?:\/\/', 'i');
if (url.toLowerCase().indexOf(window.location.hostname) == -1 && httpRegex.test(url)) {
jQuery(this).attr('target', '_blank');
}
});
@martinwheeler
martinwheeler / evalRuntimeAverage.js
Created April 17, 2017 01:13
Just a simple way to see how slow your code gets when using eval().
function doSomething( str, a ) {
eval( str );
console.log(a);
}
function getRandomInt( min, max ) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor( Math.random() * ( max - min ) ) + min;
}
@martinwheeler
martinwheeler / OSRSGEDataFetch.js
Created April 17, 2017 12:24 — forked from anonymous/OSRSGEDataFetch.js
Simple script to fetch OSRS GE data from their wiki pages.
// Run on a OSRS GE wiki page such as: http://2007.runescape.wikia.com/wiki/Exchange:Abyssal_whip
var prices = jQuery('[data-data]').attr('data-data').split('|'), thisprice, data = [], volumes = [], isSmall = false;
// This loop has been 'borrowed' from their implementation of Highcharts.
// http://2007.runescape.wikia.com/index.php?title=MediaWiki:Common.js/GECharts.js&action=raw&ctype=text/javascript&reviewed=1487971769
for (var i = 0; i < prices.length; i++ ) {
if ( prices[i].trim() ) {
thisprice = prices[i].split( ':' );
@martinwheeler
martinwheeler / Domino's Pizza Tracker
Created September 19, 2017 22:01
Domino's Pizza
// If you somehow lose your pizza tracking and they didn't email you the link just replace the order number at the end of this URL with the one from your paypal receipt.
https://internetorder.dominos.com.au/eStore/en/tracker?order={OrderNumberHere}
import _ from "lodash";
import React, { PureComponent } from "react";
import { render } from "react-dom";
import styled from "styled-components";
const createStyles = props => {
const {
padding,
buttons,
pt,
import React, { PureComponent } from "react";
import { render } from "react-dom";
import { css } from "glamor";
const flex = {
display: "flex"
};
const column = {
flexDirection: "column"
@martinwheeler
martinwheeler / version-check.js
Last active March 14, 2018 04:14
Find the difference between your package.json and yarn.lock versions
const fs = require('fs');
const path = require('path');
const dependencies = require('../package.json').dependencies;
const devDependencies = require('../package.json').devDependencies;
const yarnFile = fs.readFileSync(path.join(__dirname, '../yarn.lock'), 'utf8');
// Grabs the version from package.json file
const versionRegexp = new RegExp(/[0-9]+\.[0-9]+\.[0-9]+(\-(beta|rc).*)?/i);
#/usr/bin/env bash
git config --global init.templatedir '~/.git-templates' && \
mkdir -p ~/.git-templates/hooks && \
cd ~/.git-templates/hooks
cat >post-checkout <<'EOL'
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
#!/bin/sh
# Gets the current users branch
currentBranch="$(git branch | grep \* | cut -d ' ' -f2)"
# Only run if the user is on beta / beta-dev / master branches
if [ "$currentBranch" = "beta" ] || [ "$currentBranch" = "beta-dev" ] || [ "$currentBranch" = "master" ] ; then
# Needed to capture keyboard input during the pre-push stage
# https://stackoverflow.com/questions/3417896/how-do-i-prompt-the-user-from-within-a-commit-msg-hook
version: "3.2" #2.1
services:
qbittorrent:
image: lscr.io/linuxserver/qbittorrent:latest
container_name: qbittorrent
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- WEBUI_PORT=8080