How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • const { cleanup } = require("@testing-library/react");
    
    exports.mochaHooks = {
      afterEach() {
        cleanup();
      },
    };
    Docs
  • const {cleanup} = require('@testing-library/react')
    
    exports.mochaHooks = {
      afterEach() {
        cleanup()
      },
    }
    Docs
  • import * as MediaLibrary from 'expo-media-library';
    import * as FileSystem from 'expo-file-system';
    const { StorageAccessFramework } = FileSystem;
    
    async function migrateAlbum(albumName: string) {
      // Gets SAF URI to the album
      const albumUri = StorageAccessFramework.getUriForDirectoryInRoot(albumName);
    
      // Requests permissions
      const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync(albumUri);
      if (!permissions.granted) {
        return;
      }
    
      const permittedUri = permissions.directoryUri;
      // Checks if users selected the correct folder
      if (!permittedUri.includes(albumName)) {
        return;
      }
    
      const mediaLibraryPermissions = await MediaLibrary.requestPermissionsAsync();
      if (!mediaLibraryPermissions.granted) {
        return;
      }
    
      // Moves files from external storage to internal storage
      await StorageAccessFramework.moveAsync({
        from: permittedUri,
        to: FileSystem.documentDirectory!,
      });
    
      const outputDir = FileSystem.documentDirectory! + albumName;
      const migratedFiles = await FileSystem.readDirectoryAsync(outputDir);
    
      // Creates assets from local files
      const [newAlbumCreator, ...assets] = await Promise.all(
        migratedFiles.map<Promise<MediaLibrary.Asset>>(
          async fileName => await MediaLibrary.createAssetAsync(outputDir + '/' + fileName)
        )
      );
    
      // Album was empty
      if (!newAlbumCreator) {
        return;
      }
    
      // Creates a new album in the scoped directory
      const newAlbum = await MediaLibrary.createAlbumAsync(albumName, newAlbumCreator, false);
      if (assets.length) {
        await MediaLibrary.addAssetsToAlbumAsync(assets, newAlbum, false);
      }
    }
    
    Docs
  • //...
    import { library } from '@fortawesome/fontawesome-svg-core'
    import { fas } from '@fortawesome/free-solid-svg-icons'
    import { fab } from '@fortawesome/free-brands-svg-icons'
    import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
    
    library.add(fas)
    library.add(fab)
    
    Vue.component('font-awesome-icon', FontAwesomeIcon)
    
    Vue.config.productionTip = false
    
    new Vue({
      render: h => h(App),
    }).$mount('#app')
    
    /mandatoryprogrammer/CursedChrome mit
  • //...
    import { library } from '@fortawesome/fontawesome-svg-core'
    import {
      faPowerOff,
      faUpload,
      faTrash,
      faDownload
    } from '@fortawesome/free-solid-svg-icons'
    import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
    
    library.add(faPowerOff)
    library.add(faUpload)
    library.add(faTrash)
    library.add(faDownload)
    
    Vue.component('font-awesome-icon', FontAwesomeIcon)
    
    /recall-photos/recall-app gpl-3.0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples