Skip to content

Instantly share code, notes, and snippets.

View sloanlance's full-sized avatar
Certified GitHub Pro

Mr. Lance E Sloan sloanlance

Certified GitHub Pro
View GitHub Profile
@sloanlance
sloanlance / README.md
Last active July 20, 2016 16:20 — forked from lsloan/urltidy.py
Python experiments in removing contiguous slashes from URLs. The `urlparse` module should do this.

This is the README file.

@kdabir
kdabir / heredoc_json.bash
Last active January 11, 2024 02:25
json in heredoc in bash script alongwith variable substitution
_BUCKET_NAME="foo.example.com"
_POLICY=$(cat <<EOT
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
@omz
omz / Barcode Scanner.py
Created February 19, 2016 00:36
Barcode Scanner.py
# coding: utf-8
# Barcode scanner demo for Pythonista
# Based on http://www.infragistics.com/community/blogs/torrey-betts/archive/2013/10/10/scanning-barcodes-with-ios-7-objective-c.aspx
from objc_util import *
from ctypes import c_void_p
import ui
import sound
found_codes = set()
@Dutcho
Dutcho / Appex GetFromURL.py
Created December 26, 2015 14:38
Appex GetFromURL
# coding: utf-8
# Olaf, Dec 2015, Pythonista 1.6 beta
'''Appex GetFromURL
Pythonista app extension for use on share sheet of other apps to import file from URL into Pythonista
The file is saved at HOME/DESTINATION without user interaction (no 'save as' dialog) unless duplicate'''
from __future__ import print_function
try:
import appex, console, contextlib, itertools, os, os.path, sys, time, urllib, urlparse
@SpaceVoyager
SpaceVoyager / pythonista_compile_howto.md
Last active December 2, 2023 11:58
How to make a standalone iOS app with Pythonista

After you made some cool games or apps with Pythonista, you may want to make it run as a standaone app on iPad/iPhone and possibly share it on the AppStore. This how-to tells you how to do it.

What you need:

  1. Pythonista code you wrote
  2. A Mac with Xcode 7.1 installed
  3. iPhone/iPad running iOS 9

Steps:

  1. Download PythonistaProjectTemplate.zip. The original PythonistaProjectTemplate described at http://olemoritz.net/pythonista-15-whats-new-and-whats-missing.html does not work with Xcode 7. I updated it to work with Xcode 7 and added a more interesting example than the plain old Hello World thing.
  2. Unzip the file and open the project in Xcode 7.1. In project settings, change the Bundle Identifier from com.yuhangwang.pythonistaproject to something else.
@pudquick
pudquick / pip-mini.py
Last active October 23, 2016 03:44
Minimal version of pip in a standalone form for handling pure python situations (Pythonista, etc.)
# Standalone mini version of pip
# Geared towards Pythonista, but easily adaptable to other pure python installs
import argparse, copy, gzip, os, os.path, re, requests, shutil, site, sys, tarfile, time, xmlrpclib
# Where packages will end up installed
site_packages = site.USER_SITE
# Root of Pythonista saveable document location
pythonista_base = os.path.split(site_packages)[0]
# Temporary directory for work
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@jvandyke
jvandyke / button.html
Created February 26, 2014 22:15
Replace text in an element with CSS
<button class="element">Old text</button>
@paulmaloney
paulmaloney / vector.css
Last active October 11, 2018 17:57 — forked from krisnoble/vector.css
1. Added extra line-height in body copy. 2. Added line-height to the title and made bold. 3. Aligned images to the left. 4. Added italic to the site sub. 5. Added link color and decoration and hover color. 6. Optional old style wiki logo Screenshot: http://mlny.in/QMoE Optional Logo Screenshot: http://mlny.in/QNDG
body {font-family:"Open Sans", "Helvetica Neue", Arial, sans-serif;}
h1, h2, h3, h4, h5, h6 {border-bottom-color:#ddd;}
p {line-height:1.8em; margin-bottom:1.8em;}
#mw-content-text {font-size:1.1em; line-height:1.8em;}
li:last-of-type, dd:last-of-type {margin-bottom:1.3em;}
#mw-content-text h2 {padding-top:1.7em;}
a, div#content a.external {color:#00d;}
a:visited, div#content a.external:visited{color:#90d;}
.mw-editsection, .mw-editsection a {color:#ccc !important;}
#mw-panel .portal{-webkit-transition:opacity 250ms ease; opacity:0.3;}
@krisnoble
krisnoble / vector.css
Last active October 11, 2018 17:55
A custom vector.css for Wikipedia. Living document-style, this will be updated as I find other minor tweaks. See http://simianstudios.com/blog/post/a-quick-and-easy-way-to-a-cleaner-more-readable-wikipedia for more info!
body {font-family:"Open Sans", "Helvetica Neue", Arial, sans-serif;}
h1, h2, h3, h4, h5, h6 {border-bottom-color:#ddd;}
p {line-height:1.3em; margin-bottom:1.3em;}
#mw-content-text {font-size:1.1em; line-height:1.3em;}
li:last-of-type, dd:last-of-type {margin-bottom:1.3em;}
#mw-content-text h2 {padding-top:1.7em;}