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
var assert = require('assert') | |
var util = require('util') | |
function test (inherits) { | |
function Fruit () { | |
} | |
Fruit.prototype.round = false | |
Fruit.prototype.sweet = true | |
Fruit.prototype.eat = function () {} |
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 | |
from objc_util import * | |
## this is bad python styling, but I justify it by saying the | |
## function is an alias for the UIColor class | |
def UIColor(red=1.0, green=1.0, blue=1.0, alpha=1.0): | |
UIColor = ObjCClass('UIColor') | |
r = CGFloat(red) | |
g = CGFloat(green) |
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 | |
from objc_util import * | |
import threading | |
NSBundle = ObjCClass('NSBundle') | |
LocalAuthentication = NSBundle.bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework') | |
LocalAuthentication.load() | |
LAContext = ObjCClass('LAContext') | |
# authenticate() will raise one of these exceptions when authentication |
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 org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; | |
import org.springframework.data.redis.core.RedisTemplate; | |
import org.springframework.data.redis.serializer.StringRedisSerializer; | |
@Configuration | |
public class Config { | |
@Bean |
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 | |
'''Creates a zip archive of your Pythonista files and serves them via HTTP in your local network.''' | |
import sys | |
if sys.version_info[0] >= 3: | |
from http.server import SimpleHTTPRequestHandler, HTTPServer | |
else: | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
from BaseHTTPServer import HTTPServer |
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 ui | |
class TabbedView(ui.View): | |
def __init__(self,tablist=[], frame=(0,0)+ui.get_screen_size()): | |
'''takes an iterable of Views, using the view name as the tab selector. | |
empty views sre just given generic names''' | |
self.tabcounter=0 #unique counter, for name disambiguation | |
self.buttonheight=30 #height of buttonbar | |
#setup button bar | |
self.tabbuttons=ui.SegmentedControl(frame=(0,0,self.width, self.buttonheight)) | |
self.tabbuttons.action=self.tab_action |
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
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip | |
# Credits | |
# | |
# The python code here was written by pudquick@github | |
# | |
# License | |
# | |
# This code is released under a standard MIT license. | |
# |
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 os, os.path, sys, urllib2, requests | |
class PyPiError(Exception): | |
def __init__(self, value): | |
self.value = value | |
def __str__(self): | |
return repr(self.value) | |
def _chunk_report(bytes_so_far, chunk_size, total_size): | |
if (total_size != None): |