Skip to content

Instantly share code, notes, and snippets.

View khilnani's full-sized avatar

Nik Khilnani khilnani

View GitHub Profile
@BashedCrab
BashedCrab / Hydrogen.py
Last active March 19, 2023 04:14
Hydrogen - A lightweight GUI framework for Pythonista
#
# Hydrogen is a lightweight GUI framework for Pythonista
#
# Hydrogen - https://gist.github.com/BashedCrab/5924965
#
# HydrogenLayouts - https://gist.github.com/BashedCrab/6103019
#
# HydrogenDemo - https://gist.github.com/BashedCrab/5953776
#
@shripadk
shripadk / watch_jade.js
Last active December 17, 2015 22:49
Script that watches Jade files and compiles all of them to a single javascript file.
#!/usr/bin/env node
/**
* dependencies:
* clientjade (sudo npm install -g clientjade)
* chokidar (sudo npm install chokidar)
* how to run:
* node watch_jade.js
* to render template, just call:
* jade.render(domNode, templateName, data);
*/
@omz
omz / ShortURL.py
Created May 17, 2013 04:17
ShortURL
# Simple URL shortener using is.gd
#
# Save this script as 'ShortURL' in Pythonista and add the
# bookmarklet below to Safari. The result is copied to the clipboard.
# Bookmarklet:
# javascript:window.location.href='pythonista://ShortURL?action=run&argv='+encodeURIComponent(window.location.href);
import clipboard
import re
import requests, random, datetime, sys, webbrowser, console
def main():
song_page = None
if (len(sys.argv) > 0):
try:
song_page = sys.argv[1]
except Exception:
song_page = None
if not song_page:
@jedwood
jedwood / sample-test-2.js
Created April 4, 2013 15:33
API Testing Example - Part 2
describe('/blog', function() {
it('returns blog posts as JSON', function(done) {
api.get('/blog')
.set('x-api-key', '123myapikey')
.auth('correct', 'credentials')
.expect(200)
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) return done(err);
anonymous
anonymous / Flask Server.py
Created March 26, 2013 04:56
Flask Server
from flask import Flask, request
import socket
from Pypi import Installer
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World!'
@app.route('/install')
anonymous
anonymous / Pypi.py
Created March 26, 2013 04:46
Pypi
import urllib
import tarfile
import shutil
import console
import os
class Installer(object):
name = None
version = None
firstLetter = None
@davenicholls
davenicholls / gistcheck.py
Last active July 25, 2016 00:40 — forked from spencerogden/gistcheck.py
Script for use with Pythonista to store and retrieve gists. This version simply combines the auth() function from a script by Westacular with a version of that script updated and enhanced by spencerogden.
# Source: https://gist.github.com/5212628
#
# All-purpose gist tool for Pythonista.
#
# When run directly, this script sets up four other scripts that call various
# functions within this file. Each of these sub-scripts are meant for use as
# action menu items. They are:
#
# Set Gist ID.py - Set the gist id that the current file should be
# associated with.
@maddievision
maddievision / callback.md
Last active August 8, 2023 14:43
callback - A simple small module for Pythonista (http://omz-software.com/pythonista) which aims to make an easy callback URL handling & argument passing system.

callback

A simple small module for Pythonista (http://omz-software.com/pythonista) which aims to make an easy callback URL handling & argument passing system.

Usage

  1. import callback
  2. Create a handler instance handler = callback.InfoHandler(sys.argv)
  3. Decorate command handlers with @handler.cmd(cmdname)
  4. Call handler.handle() (and if it returns False, there was nothing to handle!)
@omz
omz / Evernote Demo.py
Created February 27, 2013 15:08
Evernote Demo
# A simple Evernote API demo script that lists all notebooks in the user's
# account and creates a simple test note in the default notebook.
#
# Before running this sample, you must fill in your Evernote developer token!
#
# This sample is part of the Evernote SDK and has been modified slightly for
# Pythonista, to take advantage of the clipboard and PIL modules.
# If there is an image in the clipboard when the script is run, it is attached
# to the sample note.