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
function listDocsInFolder() { | |
var folderId = '########' // folder id that can be retrived from the url of the Google Drive folder | |
var folder = DriveApp.getFolderById(folderId); | |
var files = folder.getFiles(); | |
var fileDetails = [] | |
while (files.hasNext()){ | |
file = files.next(); | |
fileDetails.push({id:file.getId(), name: file.getName()}) | |
} | |
var jsonFiles = JSON.stringify(fileDetails, null, 2) |
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
<head> | |
<title>### Google Slides name ###</title> | |
</head> | |
<body><iframe | |
src="https://docs.google.com/presentation/d/### Google Slides id ###/embed | |
frameborder="0" | |
width="960" | |
height="569" | |
allowfullscreen="true" | |
mozallowfullscreen="true" |
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
function listDocsInFolder() { | |
var folderId = '########' // folder id that can be retrived from the url of the Google Drive folder | |
var folder = DriveApp.getFolderById(folderId); | |
var files = folder.getFiles(); | |
while (files.hasNext()){ | |
file = files.next(); | |
Logger.log('File name: %s', file.getName()); | |
Logger.log('File id: %s', file.getId()); | |
... | |
} |
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
<head> | |
<title>A page embedding a Google Docs published document</title> | |
</head> | |
<body><iframe | |
src="https://docs.google.com/presentation/d/abcs........1234/embed?start=false&loop=false&delayms=3000" | |
frameborder="0" | |
width="960" | |
height="569" | |
allowfullscreen="true" | |
mozallowfullscreen="true" |
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
export function bufferConcatMap<T, R>(project: (val: T[], index: number, bufferIndex: number) => Observable<R>) { | |
return (sourceObservable: Observable<T>) => { | |
// buld the Observable returned by this operator | |
return defer(() => { | |
// this function will be called each time this Observable is subscribed to. | |
// initialize the state - these variables will hold the state for every subscripition of the returned Observable | |
let bufferedNotifications = [] as T[]; | |
let processing = false; | |
let _index = -1; // index of the notification from upstream |
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
// example of how to use bufferConcatMap | |
import { delay, interval, of, take } from 'rxjs'; | |
import { bufferConcatMap } from './bufferedConcatMap'; | |
// source Observable | |
const source = interval(100).pipe(take(5)); | |
// new transformed Observable created with bufferConcatMap | |
// this is when bufferConcatMap is actually invoked |
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
export function bufferConcatMap<T, R>(project: (val: T[]) => Observable<R>) { | |
return (sourceObservable: Observable<T>) => { | |
// this function will be called each time this Observable is subscribed to. | |
// initialize the state - these variables will hold the state for every | |
// subscripition of the returned Observable | |
let bufferedNotifications = [] as T[]; | |
let processing = false; | |
// buld the Observable returned by this operator |
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
export const AnotherComponent: FC = () => { | |
const [data, setData] = useState("No data received yet from remote service"); | |
return ( | |
<div className="AnotherComponent"> | |
<h3>AnotherComponent</h3> | |
<p>{data}</p> | |
</div> | |
); |
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
const myService = useContext(MyServiceContext); | |
const [data, setData] = useState("No data received yet from remote service"); | |
useEffect(() => { | |
const data$ = myService.remoteData$.pipe( | |
tap((data) => setData(data)) | |
); | |
const reset$ = myService.reset$.pipe( | |
tap((data) => setData("")) | |
); |
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
const service = new MyService(); | |
export const MyServiceContext = React.createContext(service); |
NewerOlder