This file contains hidden or 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 Foundation | |
import XcodeKit | |
class SourceEditorCommand: NSObject, XCSourceEditorCommand { | |
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void ) -> Void { | |
// Implement your command here, invoking the completion handler when done. Pass it nil on success, and an NSError on failure. | |
print("command identifier: \(invocation.commandIdentifier)") | |
print("content UTI: \(invocation.buffer.contentUTI)") | |
print("tab width: \(invocation.buffer.tabWidth)") |
This file contains hidden or 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
#!/bin/bash | |
myArray=($(xcrun simctl list pairs | grep Booted | cut -d "(" -f2 | cut -d ")" -f1)) | |
tail -f ~/Library/Logs/CoreSimulator/${myArray[0]}/system.log -f ~/Library/Logs/CoreSimulator/${myArray[1]}/system.log |
This file contains hidden or 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
{ | |
"entry": [ | |
{ | |
"id": "entry_id", | |
"time": 1485670019761, | |
"messaging": [ | |
{ | |
"sender": { | |
"id": "USER_ID" | |
}, |
This file contains hidden or 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
def send_message(recipient_id, message_text): | |
params = { | |
"access_token": os.environ["PAGE_ACCESS_TOKEN"] | |
} | |
headers = { | |
"Content-Type": "application/json" | |
} | |
data = json.dumps({ | |
"recipient": { | |
"id": recipient_id |
This file contains hidden or 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
@app.route('/', methods=['GET']) | |
def verify(): | |
# when the endpoint is registered as a webhook, it must echo back | |
# the 'hub.challenge' value it receives in the query arguments | |
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"): | |
if not request.args.get("hub.verify_token") == os.environ["VERIFY_TOKEN"]: | |
return "Verification token mismatch", 403 | |
return request.args["hub.challenge"], 200 |
This file contains hidden or 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 | |
import StringIO | |
import csv | |
import requests | |
from bs4 import BeautifulSoup | |
import time | |
import random | |
from Models import * | |
This file contains hidden or 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 peewee import * | |
import datetime | |
class DateHandler: | |
def __init__(self): | |
pass | |
THIS_YEAR = datetime.datetime.now().year |
This file contains hidden or 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
# 這段程式碼來自莫煩 Python: https://morvanzhou.github.io/tutorials/machine-learning/keras/2-1-regressor/ | |
from keras.models import Sequential | |
from keras.layers import Dense | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# 建立 X, Y 兩組資料用來練習 keras 的使用 | |
X = np.linspace(-1, 1, 200) | |
np.random.shuffle(X) | |
Y = 0.5 * X + 2 + np.random.normal(0, 0.05, (200, )) |
This file contains hidden or 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 | |
# In[ ]: | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
get_ipython().magic('matplotlib inline') |
This file contains hidden or 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
class Solution { | |
func isOneEditDistance(_ s: String, _ t: String) -> Bool { | |
if (s.count == t.count) { | |
return countOfReplaced(s, t) == 1 | |
} | |
if (s.count == t.count - 1) { | |
return isRemoved(s, t) | |
} | |
if (t.count == s.count - 1) { |