Whenever we want to share data across domains. Additionally, thanks to Angular’s dependency injection system, this is both very easy to do and very clean.
module.service( 'Book', [ '$rootScope', function( $rootScope ) {
var service = {| if (!Date.prototype.toISOString) { | |
| Date.prototype.toISOString = function () { | |
| function pad(n) { return n < 10 ? '0' + n : n; } | |
| function ms(n) { return n < 10 ? '00'+ n : n < 100 ? '0' + n : n } | |
| return this.getFullYear() + '-' + | |
| pad(this.getMonth() + 1) + '-' + | |
| pad(this.getDate()) + 'T' + | |
| pad(this.getHours()) + ':' + | |
| pad(this.getMinutes()) + ':' + | |
| pad(this.getSeconds()) + '.' + |
Whenever we want to share data across domains. Additionally, thanks to Angular’s dependency injection system, this is both very easy to do and very clean.
module.service( 'Book', [ '$rootScope', function( $rootScope ) {
var service = {| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os/exec" | |
| "runtime" | |
| ) | |
| type Worker struct { |
2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
| export const getRandom32x = (x: number = 1): string => { | |
| if (x > 8) x = 8; | |
| const uint32Array = new Uint32Array(x); | |
| crypto.getRandomValues(uint32Array); | |
| return uint32Array.reduce((a: string, v: number) => { | |
| return a + v.toString(16).padStart(8, '0'); | |
| }, ""); | |
| }; |