Skip to content

Instantly share code, notes, and snippets.

import re
import string
import console
import urllib
import sys
import clipboard
import webbrowser
console.clear()
indent all
function actionHere () {
var string = op.getLineText();
if (string.charAt(0) == " ") {
op.reorg (right, 1);
var newline = string.substring(1);
op.setLineText(newline);
}
}
var ctheads = 0;
@jkishner
jkishner / split Fargo headline x times
Created November 19, 2013 19:30
This is a simple script for the menubar outline in Fargo.io that will split a headline into multiple sections. Insert a ^ wherever you want the headline split, then run the script. The text before the first ^ will stay on that line. The text after each additional ^ will be added immediately below the previous headline.
split x times
var line = op.getLineText();
var tagArray = line.split("^");
op.setLineText(tagArray[0]);
for (var i=1; i < tagArray.length; i++) {
op.insert (tagArray[i], down);
}
@jkishner
jkishner / split Fargo headline in 2
Created November 19, 2013 15:23
This is a simple script for the menubar outline in Fargo.io that will split a headline in 2. Insert a ^ where you want the headline split, then run the script. The text before the ^ will stay on that line. The text after the ^ will be added immediately below the headline. (To split a headline more than once, visit https://gist.github.com/jkishne…
split into 2
line = op.getLineText();
line1 = line.split('^')[0];
line2 = line.split('^')[1];
op.setLineText(line1);
op.insert (line2, down);
@jkishner
jkishner / export Fargo outline as HTML
Last active December 27, 2015 02:09
This script will create an HTML file in dropbox in which the cursor text is the title and all its children are rendered as unordered lists. A new window opens with the shareable Dropbox URL. Adapted from a op.visitSubs script written by Dave Winer.
export as html
var title = op.getLineText();
var s = "";
var head = "<html><body><h1>" + title + "</h1>";
var foot = "</body></html>";
op.visitSubs (
function (headline, level) {
s += string.filledString ("\t", level) + "<li>" + headline.getLineText () + "</li>\r\n";
},
function () {s += "<ul>";},
@jkishner
jkishner / Convert to Music Map in Fargo
Created October 29, 2013 19:47
use this script in Fargo on a headline containing a band/musician name. the script will insert (as a child) a link to that band on music-map.com
convert to Music-Map
var band = op.getLineText();
band = band.trim();
var newband = band.replace(" ","+");
var link = 'http://www.music-map.com/' + newband + '.html';
op.insert('Music-Map',right);
op.attributes.setOne("type","link");
op.attributes.setOne("url",link);
op.attributes.setOne("icon","map-marker");
@jkishner
jkishner / opml in wordpress
Created August 14, 2013 21:50
post an opml file as an unordered list in a wordpress post or page. just use the shortcode [opml url="OPML_URL"] in the content area. This is based on a php script by Betsy Kimak http://www.umaitech.com/cms/?p=311
<?php
/*
Plugin Name: OPML in WordPress
Author: Jeffrey Kishner
*/
function fargo2opml ($opmlfile) {
$opmfile = shortcode_atts(array(
'url' => '',
@jkishner
jkishner / todo
Created August 6, 2013 15:04
for Fargo.io: adds a checkbox to a headline that has no icon; if the icon is "check-empty" it changes it to "check"; if the icon is "check" it makes the headline a child of the last headline in the outline and then collapses that parent headline
todo
var value = op.attributes.getOne ("icon");
if (!value) {
op.attributes.setOne ("icon", "check-empty");
}
else if (value == "check-empty") {
op.attributes.deleteOne ("icon");
op.attributes.setOne ("icon", "check");
}
else if (value == "check") {
Move Child to Next Parent
op.reorg (left, 1);
op.reorg (down, 1);
op.reorg (right, 1);
@jkishner
jkishner / TweetBlog
Last active December 20, 2015 12:29
TweetBlog
var text = op.getLineText();
dialog.ask ("Enter link below", "", "", function (name) {
op.attributes.setOne("type", "link");
op.attributes.setOne("url", name);
var url = op.attributes.getOne ("url");
window.open("https://twitter.com/share?text=" + text + "&url=" + url,"_blank");
var date = clock.now().toDateString();
op.insert ("Posted: " + date, up);
op.attributes.setOne("icon", "twitter-sign");