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
#!/usr/bin/env python | |
import random | |
from random import randrange | |
import sys | |
from time import time | |
from datetime import datetime | |
whole_fsc_dict={} | |
whole_imp_v=[] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" this is the implementation for modified apriori algorithm (kuok's algorithm) | |
minsupport and minconfidence are assumed | |
""" | |
from copy import deepcopy | |
from fuzzysubset import * | |
minsupport=0.2 # minimum support required to obtain fuzzy rules | |
minconfidence=0.4 # minimum confidence required to obtain fuzzy rules | |
#data is in the format of [{1:2, 2:4 , 3:4.5 , 4: 1.2 }] | |
# attributeinfo gives the relevant information about the attribute format is {1:[low1 , medium1 ], 2:[low, high, medium] }.etc |
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
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/ | |
$ git add . | |
$ git status // to see what changes are going to be commited | |
$ git commit -m 'Some descriptive commit message' | |
$ git push origin master | |
$ git checkout gh-pages // go to the gh-pages branch | |
$ git rebase master // bring gh-pages up to date with master | |
$ git push origin gh-pages // commit the changes |
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
#!/usr/bin/env python | |
# sample usage: checkstatus.py twitter.com google.com youtube.com | |
import pickle, os, sys, logging | |
from httplib import HTTPConnection, socket | |
from smtplib import SMTP | |
def email_alert(message, status): | |
fromaddr = 'you@gmail.com' |
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
override func viewDidAppear(_ animated: Bool) { | |
if let user = FIRAuth.auth()?.currentUser { | |
self.signedIn(user) | |
} | |
} | |
@IBAction func didTapSignIn(_ sender: AnyObject) { | |
// Sign In with credentials. | |
guard let email = emailField.text, let password = passwordField.text else { return } | |
FIRAuth.auth()?.signIn(withEmail: email, password: password) { (user, error) 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
deinit { | |
self.ref.child("messages").removeObserverWithHandle(_refHandle) | |
} | |
func configureDatabase() { | |
ref = FIRDatabase.database().reference() | |
// Listen for new messages in the Firebase database | |
_refHandle = self.ref.child("messages").observe(.childAdded, with: { [weak self] (snapshot) -> Void in | |
guard let strongSelf = self else { return } |
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
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
// Dequeue cell | |
let cell = self.clientTable .dequeueReusableCell(withIdentifier: "tableViewCell", for: indexPath) | |
// Unpack message from Firebase DataSnapshot | |
let messageSnapshot: FIRDataSnapshot! = self.messages[indexPath.row] | |
let message = messageSnapshot.value as! Dictionary<String, String> | |
let name = message[Constants.MessageFields.name] as String! | |
if let imageURL = message[Constants.MessageFields.imageURL] { | |
if imageURL.hasPrefix("gs://") { | |
FIRStorage.storage().reference(forURL: imageURL).data(withMaxSize: INT64_MAX){ (data, error) 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
func imagePickerController(_ picker: UIImagePickerController, | |
didFinishPickingMediaWithInfo info: [String : Any]) { | |
picker.dismiss(animated: true, completion:nil) | |
guard let uid = FIRAuth.auth()?.currentUser?.uid else { return } | |
// if it's a photo from the library, not an image from the camera | |
if #available(iOS 8.0, *), let referenceURL = info[UIImagePickerControllerReferenceURL] { | |
let assets = PHAsset.fetchAssets(withALAssetURLs: [referenceURL as! URL], options: nil) | |
let asset = assets.firstObject | |
asset?.requestContentEditingInput(with: nil, completionHandler: { [weak self] (contentEditingInput, info) 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
func fetchConfig() { | |
var expirationDuration: Double = 3600 | |
// If in developer mode cacheExpiration is set to 0 so each fetch will retrieve values from | |
// the server. | |
if (self.remoteConfig.configSettings.isDeveloperModeEnabled) { | |
expirationDuration = 0 | |
} | |
// cacheExpirationSeconds is set to cacheExpiration here, indicating that any previously | |
// fetched and cached config would be considered expired because it would have been fetched |
OlderNewer