Skip to content

Instantly share code, notes, and snippets.

@philgruneich
philgruneich / New from Gist.py
Created January 30, 2016 15:39
Adds Python gists to Pythonista.
# coding: utf-8
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
#
# If a file already exists, a dialog is shown that asks whether the
# new file should be renamed or replaced.
@philgruneich
philgruneich / return1Writer.js
Created November 17, 2014 03:21
Returns to 1Writer and replaces the selection with a Markdown link from the Safari page.
javascript:window.location='onewriter://x-callback-url/replace-selection?text='+encodeURIComponent('%5B%5D('+location.href+'%20%5C''+document.title+'%5C')')
@philgruneich
philgruneich / check_training_demand.js
Created May 1, 2018 21:16
CSM: calculate how much training will require to reach limits before 28yo on transfer list
Array.from(document.querySelectorAll('article.player')).forEach((player) => {
const age = +player.querySelector('.general .first-col li:nth-child(2)').textContent.substr(5, 2);
const rx = /(\d+)[^\d]*(\d+)?/;
const skills = player.querySelector('.skills-bar');
const aim = skills.querySelector('li:first-child .visual').textContent.trim().match(rx);
const handling = skills.querySelector('li:nth-child(3) .visual').textContent.trim().match(rx);
const quickness = skills.querySelector('li:nth-child(5) .visual').textContent.trim().match(rx);
const determination = skills.querySelector('li:nth-child(6) .visual').textContent.trim().match(rx);
const awareness = skills.querySelector('li:nth-child(7) .visual').textContent.trim().match(rx);
let player_skills = {
@philgruneich
philgruneich / gist:77d5f3c6c76717cd62e59de7ba6e9137
Created May 1, 2018 15:38
Automatically trains pickup players GLB2
var request = new XMLHttpRequest();
var counter = 0;
var limit = 40; // Trains 40 times
var counterFunction = function() {
request.abort();
request.open('POST', '/game/player/' + glb2.player.playerId + '/pickup_join', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
if (!!+request.responseText) ++counter;
if (counter >= limit) window.clearInterval(interval)
@philgruneich
philgruneich / tumblr.js
Created May 13, 2015 16:54
Open in Tumblr App
javascript:(function() {var tumblr=document.querySelector("meta[name='twitter:app:url:iphone']").getAttribute('content');if (tumblr.match(/^tumblr:\/\/x-callback-url\/blog\?.*/)) window.location=tumblr;})();
@philgruneich
philgruneich / superstar.json
Created December 10, 2014 23:00
Superstar JSON
"superstar_avg": {
"skill_modifiers": {
"punt_power": {
"cost": -0.2,
"max": 10
},
"tackle_awareness": {
"cost": -0.2,
"max": 10
},
@philgruneich
philgruneich / openOnTweetbotRiposte.js
Created November 17, 2014 03:23
Grabs username from App.net or Twitter profile on Safari, prompts on Launch Center Pro for action and triggers the chosen app: [Tweetbot](https://itunes.apple.com/us/app/tweetbot-3-for-twitter.-elegant/id722294701?mt=8&uo=4&at=10l4KL) or [Riposte](https://itunes.apple.com/us/app/riposte-for-app.net/id592316697?mt=8&uo=4&at=10l4KL).
javascript:window.location='launchpro://?url='+encodeURIComponent('[list:Open '+location.pathname.substring(1)+'|Mention on Tweetbot=tweetbot:///post?text=%40|Open on Tweetbot=tweetbot:///user_profile/|Mention on Riposte=riposte://x-callback-url/createNewPost?text=%40]'+location.pathname.substring(1))
@philgruneich
philgruneich / evernoteWebclipper.js
Created November 17, 2014 03:22
Cleans the content of your current page and creates a new note in Evernote.
javascript:(function(){var request=new XMLHttpRequest();request.open("GET","http://heckyesmarkdown.com/go/?read=1&md=0&preview=0&showframe=0&output=url&u="+encodeURIComponent(location.href),true);request.send();request.onreadystatechange=function(){location.href="evernote://x-callback-url/new-note?type=html&title="+encodeURIComponent(window.document.title)+"&text="+request.responseText};})();
@philgruneich
philgruneich / evernoteWebclipperDrafts.js
Created November 17, 2014 03:22
Cleans the content of your current page and sends it to Drafts, which creates a new note in Evernote and includes geolocation. Requires the Markdown to Evernote action.
javascript:(function(){var request=new XMLHttpRequest();request.open("GET","http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=url&u="+encodeURIComponent(location.href),true);request.send();request.onreadystatechange=function(){location.href="drafts4://x-callback-url/runAction?text="+encodeURIComponent(window.document.title + "\n")+request.responseText+"&action=Markdown To Evernote"};})();
@philgruneich
philgruneich / sourceCodeTextastic.js
Created November 17, 2014 03:16
Opens the source code from the current page on Textastic
javascript:location.href=(function(){var href=location.href;return "textastic"+href.substring(href.indexOf("://"));})();