Skip to content

Instantly share code, notes, and snippets.

import numpy
import pandas as pd
from pandas import Series
def initialize(context):
g.count = 30
g.cash = 1000000
g.buy_stock = []
g.initial_price = {}
g.month = context.current_dt.month
//
// TraditionalTime.swift
// iOS-Startup
//
// Created by Yaqing Wang on 4/24/17.
// Copyright © 2017 Yaqing Wang. All rights reserved.
//
import Foundation
//: Introduce Local Extension
/*:
*/
import Foundation
struct DateWrapper {
private var origDate: Date
init(date: Date) {
//: Introduce Local Extension
/*:
*/
import Foundation
struct DateWrapper {
private var origDate: Date
init(date: Date) {
public typealias TimerExcuteClosure = @convention(block) () -> ()
extension Timer {
private class TimerActionBlockWrapper : NSObject {
var block : TimerExcuteClosure
init(block: @escaping TimerExcuteClosure) {
self.block = block
}
}
# encoding: UTF-8
require 'cucumber/formatter/html'
class NewHtml < Cucumber::Formatter::Html
def initialize(step_mother, path_or_io, options)
super(step_mother, path_or_io, options)
@summary={}
@currentFeature = ""
end
//: Playground - noun: a place where people can play
import XCPlayground
import UIKit
class VerticalEqualSpacingView :UIView {
var spacing:CGFloat = 0 {
didSet {
guard oldValue != spacing else { return }
@billwang1990
billwang1990 / NSObject+DumpClass
Created December 31, 2015 06:32
dump object properties in swift
import Foundation
extension NSObject {
//
// Retrieves an array of property names found on the current object
// using Objective-C runtime functions for introspection:
// https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html
//
func propertyNames() -> Array<String> {
@billwang1990
billwang1990 / ObjectMapper+Alamofire+RxSwift
Created October 30, 2015 06:24
ObjectMapper+Alamofire+RxSwift
//
// RxAlamofireObjMapper.swift
// RXDemo
//
// Created by Yaqing Wang on 10/30/15.
// Copyright © 2015 billwang1990.github.io. All rights reserved.
//
import Foundation
import Alamofire
@billwang1990
billwang1990 / NSTimer+Closure
Created October 14, 2015 07:44
Non retain cycle NSTimer in Swift
public typealias TimerExcuteClosure = @convention(block)()->()
extension NSTimer{
public class func YQ_scheduledTimerWithTimeInterval(ti:NSTimeInterval, closure:TimerExcuteClosure, repeats yesOrNo: Bool) -> NSTimer{
return self.scheduledTimerWithTimeInterval(ti, target: self, selector: "excuteTimerClosure:", userInfo: unsafeBitCast(closure, AnyObject.self), repeats: true)
}
class func excuteTimerClosure(timer: NSTimer)
{
let closure = unsafeBitCast(timer.userInfo, TimerExcuteClosure.self)