using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
| # do our update | |
| @controller.record_votes(winner._id.to_s, loser._id.to_s) | |
| # will this pass or fail? who knows!? | |
| Item.count(conditions:{ votes:1 }).should == 0 |
#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.
To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.
##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application
Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.
| owncloud: | |
| image: owncloud | |
| links: | |
| - mariadb:mysql | |
| - redis:redis | |
| ports: | |
| - 8081:80 | |
| volumes: | |
| - /opt/docker-persist/owncloud/apps:/var/www/html/apps | |
| - /opt/docker-persist/owncloud/config:/var/www/html/config |
| #!/bin/sh | |
| # Reset Parallels Desktop's trial and generate a casual email address to register a new user | |
| rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml | |
| jot -w pdu%[email protected] -r 1 |
Generate the list yourself:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'
| MKMapRect zoomRect = MKMapRectNull; | |
| for (id <MKAnnotation> annotation in mapView.annotations) { | |
| MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); | |
| MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); | |
| if (MKMapRectIsNull(zoomRect)) { | |
| zoomRect = pointRect; | |
| } else { | |
| zoomRect = MKMapRectUnion(zoomRect, pointRect); | |
| } | |
| } |
| I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer. | |
| I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc). | |
| # Install rvm (no sudo!) | |
| # ------------------------------------------------------ | |
| bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
| source ~/.rvm/scripts/rvm | |
| rvm install ree-1.8.7-2010.02 |