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
// Ask the coffee machine at IP 192.168.2.2 to do its job | |
device('192.168.2.2') | |
.do( 'coffee' ) | |
.then( wakeMeUpCallback ) | |
// turn all lights on | |
device.findAll('light').do('turnOn') |
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
// purchase a product with a credit card | |
purchase('productId') | |
.using( { | |
cc: "4556934156210213", | |
valid: "2016-10", | |
csc: "123" | |
} ) | |
// purchase a product with paypal | |
purchase('productId') |
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
// convert a dom element to a PDF and download it | |
convert( $('.invoice') ).to( 'invoice.pdf' ).download() | |
// alternatively | |
download( convert( $('.invoice') ).to( 'invoice.pdf' ) ) | |
// convert another website to a png and show it on the page | |
convert( 'http://exam.pl/page' ).toImage().then( $('.screenshots').append ) | |
// attach a file to an email |
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
// add a new object | |
var type = 'note'; | |
var attributes = {color: 'red'}; | |
store.add(type, attributes) | |
.done(function (newObject) {}); | |
.fail(function (error) {}); | |
// update an existing object | |
var type = 'note'; | |
var id = 'abc4567'; |
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
// sign up | |
account.signUp('joe@example.com', 'secret'); | |
// sign in | |
account.signIn('joe@example.com', 'secret'); | |
// sign in via oauth | |
account.signInWith('twitter'); | |
// sign out |
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://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
NewerOlder