Skip to content

Instantly share code, notes, and snippets.

View Adm94's full-sized avatar
🃏
Busy or not ?

Genki Adams Adm94

🃏
Busy or not ?
View GitHub Profile
@surajtruckx
surajtruckx / sql.ts
Last active May 8, 2021 12:03
Sql Provider
import { Injectable } from '@angular/core';
import { SQLite } from '@ionic-native/sqlite';
import { Platform } from 'ionic-angular';
import { isEmpty, isNull, keys, sortBy, get, parseInt } from 'lodash';
import { browserDBInstance } from './browser';
declare var window: any;
const SQL_DB_NAME = process.env.IONIC_ENV === 'dev' ? '__broswer.db' : '__native.db';
@Injectable()
@steffenr
steffenr / file_media_entity.php
Last active February 27, 2023 18:33
[Drupal 8] Create file/ media_entity programmatically
<?php
$filesystem = \Drupal::service('file_system');
// Create file entity.
$image = File::create();
$image->setFileUri($destination);
$image->setOwnerId(\Drupal::currentUser()->id());
$image->setMimeType('image/' . pathinfo($destination, PATHINFO_EXTENSION));
$image->setFileName($filesystem->basename($destination));
$image->setPermanent();
$image->save();