Skip to content

Instantly share code, notes, and snippets.

View fangpenlin's full-sized avatar
🚀

Fang-Pen Lin fangpenlin

🚀
View GitHub Profile
app = XCUIApplication()
app.launchEnvironment["ENV_VAR"] = "Env value"
app.launchArguments = ["-user-id", "12345"]
app.launch()
client = MockAPIClient()
client.returnValueForGetUser = "MOCK_DATA"
class MockAPIClient: APIClientProtocol {
var returnValueForGetUser: String
func getUser(id: String) {
return returnValueForGetUser
}
}
import Embassy
import EnvoyAmbassador
let loop = try! SelectorEventLoop(selector: try! KqueueSelector())
let router = Router()
let server = HTTPServer(
eventLoop: loop,
app: router.app,
port: 8080
)
public typealias SWSGI = (
environ: [String: Any],
startResponse: ((String, [(String, String)]) -> Void),
sendBody: ([UInt8] -> Void)
) -> Void
import datetime
begin = datetime.time(11, 48)
end = datetime.time(12, 15)
#timedelta = end - begin
#print timedelta
timedelta = datetime.timedelta(seconds=26)
def time_add(t, delta):
@fangpenlin
fangpenlin / gist:6204321
Created August 11, 2013 10:24
Billy errors on import fixed branch
EEEEEEEEEEEEEEE
======================================================================
ERROR: Failure: ImportError (cannot import name sample_customer_2)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\loader.py", line 413, in loadTestsFromName
addr.filename, addr.module)
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\importer.py", line 94, in importFromDir
@fangpenlin
fangpenlin / gist:6204313
Created August 11, 2013 10:21
Billy test errors on master branch
EEEEEEEEEEEEEEEE
======================================================================
ERROR: Failure: InvalidRequestError (Table 'charge_subscription' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\loader.py", line 413, in loadTestsFromName
addr.filename, addr.module)
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "C:\GitHub\billy\env\lib\site-packages\nose-1.3.0-py2.7.egg\nose\importer.py", line 94, in importFromDir
import csv
f2_ids = set()
f2 = open('file2.txt', 'rt')
f2_reader = csv.reader(f2)
for row in f2_reader:
f2_ids.add(row[0])
f1 = open('file1.txt', 'rt')
for line in f1.readlines():
for line in file.readlines():
parts = line.split(':')
print parts[-2], parts[-1]
break