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
; http://www.algolist.com/Dijkstra's_algorithm | |
(defn dijkstra [g src] | |
(loop [dsts (assoc (zipmap (keys g) (repeat nil)) src 0) | |
curr src | |
unvi (apply hash-set (keys g))] | |
(if (empty? unvi) | |
dsts | |
(let [unvi (disj unvi curr) | |
nextn (first (sort-by #(% dsts) unvi)) |
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
<?php | |
$mongoDB = new Mongo(); | |
$database = $mongoDB->selectDB("BVS"); | |
$collection = $database->createCollection('fs.files'); | |
//to get the attachments metadata back | |
$query = array("metadata.formdata.claimid" => "SUS14052012-001"); | |
// $items is a cursor of mongodata | |
$items = $collection->find($query); | |
//iterate through the collection and retrieve the named file | |
$grid = $database->getGridFS(); |
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
<?php | |
$mongoDB = new Mongo(); | |
$database = $mongoDB->selectDB("BVS"); | |
$collection = $database->createCollection('fs.files'); | |
$search = array("metadata.formdata.claimid" => "4"); | |
$replace = array('$set'=>array("metadata.formdata.mynewfield" => "wibble")); // note use of single quotes around $set. This is compulsory | |
$multiple = array("multiple" => true); // used to update all records that match default is false (update first record only) | |
$collection->update($search, $replace, $multiple); | |
?> |
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
/** | |
* | |
* Save pkpass to PassWallet | |
* See http://passwallet.attidomobile.com/PassWallet%20Developer%20Guide.pdf | |
* | |
*/ | |
function shareToPassWallet () { | |
var pkpassFile, | |
intent, |
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
import UIKit | |
import Foundation | |
class ViewController: UIViewController, NSURLSessionDelegate { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
httpGet(NSMutableURLRequest(URL: NSURL(string: "https://example.com")!)) | |
} |