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
| function extend(Child, Parent) { | |
| var F = function(){}; | |
| F.prototype = Parent.prototype; | |
| Child.prototype = new F(); | |
| Child.prototype.constructor = Child; | |
| Child.uber = Parent.prototype; | |
| } | |
| function Animal(cat){ | |
| this.species = "动物"; |
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
| ### | |
| #Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html) | |
| ### | |
| #Assuming your starting from a clean directory | |
| mkdir server | |
| cd server | |
| #generate private key |
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 "ViewController.h" | |
| @implementation ViewController | |
| - (void)viewDidLoad { | |
| [super viewDidLoad]; | |
| [self createTableView]; | |
| } | |
| NSString* const c1 =@"folder"; |
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 UIKit | |
| import appbase | |
| @UIApplicationMain | |
| class App: AppBase{ | |
| override func run(){ | |
| let http = Http() | |
| http.get("https://httpbin11111.org/ip11"){(data) in | |
| do{ | |
| let json = try JSONSerialization.jsonObject(with: data, options:[]) | |
| print("json: \(json)") |
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 UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| self.window = UIWindow(frame: UIScreen.main.bounds) | |
| let page = Page1() | |
| self.window!.rootViewController = page | |
| self.window?.makeKeyAndVisible() | |
| return true |
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
| function isInt(str){ | |
| var i | |
| for (i = 0; i < str.length; i++) { | |
| var c = str[i] | |
| if (!"0123456789-".includes(c)) | |
| return false | |
| } | |
| if (str.includes("-") && str[0]!="-" || str.length==1) | |
| return false | |
| return true |
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
| describe("Int Checker", function() { | |
| describe("isInt suite", function() { | |
| beforeEach(function() { | |
| }); | |
| it("输入案例123返回true", function() { | |
| var result = isInt("123") | |
| expect(result).toEqual(true); | |
| // expect(result).toBeFalsy(); | |
| // expect(player).not.toBePlaying(song); |
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
| <script type="text/javascript"> | |
| window.onload = function() { | |
| var current, | |
| screen, | |
| output, | |
| limit, | |
| zero, | |
| period, | |
| operator; | |
| screen = document.getElementById("result"); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Building a router</title> | |
| <script> | |
| var routes = {}; | |
| function route (path, innerHTML) { | |
| routes[path] = {innerHTML: innerHTML}; | |
| } |
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 UIKit | |
| typealias callbackJsonError = (_ json:[String:Any],_ error : Error?)-> Void | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate,URLSessionDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| loadJSON("https://httpbin.org/ip"){(json,error )in | |
| var j = JSONData() | |
| j.loadFrom(json) | |
| print(j.origin) |