Skip to content

Instantly share code, notes, and snippets.

@philgruneich
philgruneich / kirby_video.php
Last active February 26, 2024 07:00
This extension includes the HTML5 video tag as kirbytext and has several optional parameters. It accepts input of .ogg, .webm and custom fallback. If you don't choose width and height, it picks the one in the config.php file. It also supports class and title.
<?php
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
$this->addTags('video');
@miklb
miklb / py_forecast.py
Last active June 14, 2016 19:54
Pythonista script to grab your current location, then retrieve current weather via forecast.io
# -*- coding:utf-8 -*
import location
import re
import sys
import json
import urllib
import webbrowser
from os import environ
from sys import exit, argv
@aloncarmel
aloncarmel / randombg.js
Created August 20, 2013 13:35
Grab a random background from unsplash.com and apply to a div.
function GetRandomBackground()
{
var url = 'http://unsplash.com/rss';
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
async: false,
jsonpCallback: 'jsonCallback',
contentType: "application/json",
@philgruneich
philgruneich / Send long markdown email
Created July 31, 2013 01:02
one-tap send clipboard message in markdown as an HTML email using Drafts and Launch Center Pro. This action takes the first line as recipients and the remaining as the content. This action works for emails with more than a single paragraph.
//Create the following rule at Launch Center Pro:
drafts://x-callback-url/create?text={{[[clipboard]]}}&action=Markdown%20Long
//Add the following rule to Drafts, named Markdown Long:
drafts://x-callback-url/create?text=[[body]]&action=Markdown%3A%20Copy%20to%20Clipboard&x-source=Drafts&x-success={{drafts://x-callback-url/create?text=[[title]]&action=Long%20Clipboard%20Mail&afterSuccess=Delete}}&afterSuccess=Delete
//Add this other rule to Drafts, named Long Clipboard Mail:
@ttscoff
ttscoff / Bullseye.bookmarklet
Last active January 27, 2026 15:02
A bookmarklet for grabbing just a piece of a web page and converting it to Markdown using heckyesmarkdown.com.
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://cdn.rawgit.com/ttscoff/6109434/raw/Bullseye.js?x="+(Math.random());})();
@philgruneich
philgruneich / Safari to Byword formatted as a Kirby post
Created June 26, 2013 03:29
I was looking for a solution for the absence of window.getSelection in the iPhone Safari. Decided to use the clipboard, integrating it with Drafts with more data to create a blog post at Byword, formatted for a Kirby post. Oh, we also create a Evernote note in the way (:
1. Add this bookmarklet to Safari:
javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(document.title+'%5Cn')+encodeURIComponent(location.href)+'&action=Kirbylity'
2. Add an Evernote or Dropbox action, I'm using an Evernote action called Blogquotes.
3. Add this action to Drafts, named Kirbylity:
drafts://x-callback-url/create?text=[[draft]]&action=Blogquotes&afterSuccess=Delete&x-success={{byword://new?text=Title:%20[[title]]%0d----%0dLink:%20[[body]]%0d----%0dExcerpt:%20%3e[[clipboard]]%0d----%0dText:%20%3e[[clipboard]]}}
@psychemedia
psychemedia / simplePDFtableScraper.py
Created June 17, 2013 21:55
Example Python code for a simple PDF table scraper
# 1. Add some necessary libraries
import scraperwiki
import urllib2, lxml.etree
# 2. The URL/web address where we can find the PDF we want to scrape
url = 'http://cdn.varner.eu/cdn-1ce36b6442a6146/Global/Varner/CSR/Downloads_CSR/Fabrikklister_VarnerGruppen_2013.pdf'
# 3. Grab the file and convert it to an XML document we can work with
pdfdata = urllib2.urlopen(url).read()
@ttscoff
ttscoff / itunesicon.rb
Last active September 8, 2025 04:38
Retrieve a 512 x 512px icon for an iOS app
#!/usr/bin/ruby
# encoding: utf-8
#
# Updated 2017-10-25:
# - Defaults to large size (512)
# - If ImageMagick is installed:
# - rounds the corners (copped from @bradjasper, https://github.com/bradjasper/Download-iTunes-Icon/blob/master/itunesicon.rb)
# - replace original with rounded version, converting to png if necessary
#
# Retrieve an iOS app icon at the highest available resolution
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active April 5, 2026 14:56
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@fcrespo82
fcrespo82 / pushover.py
Created March 21, 2013 21:39
This gist describes how to send messages via push to your phone using pushover API
import requests
USER_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your user key
APP_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your APP token/key
HEADERS = { "Content-type": "application/x-www-form-urlencoded" }
def sendPush(message, title, url, url_title):
parameters = { u'token': APP_TOKEN,
u'user': USER_TOKEN,