This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IMPORTANT SETUP INSTRUCTIONS: | |
# | |
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary) | |
# 2. Select "Create App" | |
# 3. Select the following settings: | |
# * "Dropbox API app" | |
# * "Files and datastores" | |
# * "(No) My app needs access to files already on Dropbox" | |
# * "All file types" | |
# * (Choose any app name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
(function (t,r) { | |
window.location = 'pythonista://clipto?action=run&argv=' + encodeURIComponent(document.title) + '&argv=' + encodeURIComponent(location.href) + '&argv=' + t + '&argv=' + r + '&argv=' + encodeURIComponent(document.getSelection()||''); | |
})('Sublime','Dropbox') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FontInstaller (by @olemoritz) | |
# This script installs a custom TTF font on iOS (system-wide). | |
# It can be used in one of two ways: | |
# 1. Simply run it in Pythonista, you'll be prompted for the URL of the font | |
# you'd like to install (if there's a URL in the clipboard, it'll be used by default) | |
# 2. Use it as an 'Open in...' handler, i.e. select this file in Pythonista's 'Open in... | |
# menu' setting. This way, you can simply download a ttf file in Safari and open it in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 中缀表达式转后缀表达式 | |
*/ | |
function isOperator (item) { | |
return item === '+' || item === '-' || item === '*' || item === '/' || item === '(' || item === ')'; | |
} | |
function convert (str) { | |
var output = [], | |
stack = [], | |
operator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// css style guide | |
// welcome to the rap genius style guide! | |
// here you will find good rules of thumb when writing css and sass. | |
// of course: the only rule that really matters is: | |
.do-whatever { content: "it's just CSS!" } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/10425287/convert-string-to-camelcase-with-regular-expression | |
// fetch me my camel, Jeeves | |
var toCamelCase function (str) { | |
return str.toLowerCase().replace(/-(.)/g, function(match, group1) { | |
return group1.toUpperCase(); | |
}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
table = '''First Header,Second Header,Third Header | |
1st Item,2nd\,Item,3rd Item | |
,One cell,Two cells | |
Two cells,One cell, | |
Awesome''' | |
ttable = [[re.sub('\\\,',',',cell) for cell in re.split('(?<!\\\),', row)] for row in table.split('\n')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
curl_setopt_array( | |
$chpush = curl_init(), | |
array( | |
CURLOPT_URL => "https://new.boxcar.io/api/notifications", | |
CURLOPT_POSTFIELDS => array( | |
"user_credentials" => 'ACCESS_TOKEN', | |
"notification[title]" => 'message title', | |
"notification[long_message]" => '<b>Some text or HTML for the full layout page notification</b>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shows the location of the last photo in the canera roll in the Maps app. | |
# (thanks to @HyShai for pointing out that the latitude/longitude refs are necessary) | |
import photos | |
import webbrowser | |
meta = photos.get_metadata(-1) | |
gps = meta.get('{GPS}') | |
if gps: | |
latitude = str(gps.get('Latitude', 0.0)) + gps.get('LatitudeRef', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Conway's game of life. | |
# Touch cells to give them life. | |
# Tap screen with two fingers to pause/un-pause. | |
# Tap screen with three fingers to give life to random cells. | |
from scene import * | |
from PIL import Image, ImageDraw | |
import random |