Skip to content

Instantly share code, notes, and snippets.

View beyondliu's full-sized avatar

Open Source Learning beyondliu

View GitHub Profile
@beyondliu
beyondliu / add_snippet.py
Last active February 6, 2018 23:03
add_snippet.py
# coding: utf-8
import os
import urllib
import requests
import appex
import console
import keychain
import photos
javascript:(function(){var a=window,b=document,c=encodeURIComponent;var txt = '';if (window.getSelection){txt=window.getSelection();}else if (document.getSelection){txt=document.getSelection();}else if (document.selection){txt=document.selection.createRange().text;}d=a.open('http://3exps.org/user/scrapbook/scraps/addScrap/?url='+c(b.location)+'&title='+c(b.title)+'&desc='+c(txt),'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=500px,width=600px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300)})();
javascript:(function(){var a=window,b=document,c=encodeURIComponent;var txt = '';if (window.getSelection){txt=window.getSelection();}else if (document.getSelection){txt=document.getSelection();}else if (document.selection){txt=document.selection.createRange().text;}d=a.open('http://3exps.org/user/scrapbook/scraps/addScrap/?url='+c(b.location)+'&title='+c(b.title)+'&desc='+c(txt),'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=500px,width=600px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300)})();
@beyondliu
beyondliu / add_scrap.py
Created March 29, 2017 02:10
add_scrap.py
import appex
import webbrowser
import urllib
from bs4 import BeautifulSoup
def main():
if not appex.is_running_extension():
print('Running in Pythonista app, using test data...\n')
url = 'http://example.com'
else:
@beyondliu
beyondliu / add_bookmark.py
Created March 29, 2017 02:08
add_bookmark.py
import appex
import webbrowser
import console
import urllib
from bs4 import BeautifulSoup
def main():
if not appex.is_running_extension():
print('Running in Pythonista app, using test data...\n')
url = 'http://example.com'