Skip to content

Instantly share code, notes, and snippets.

@tyru
tyru / app.js
Created May 10, 2016 16:19
Lazy Loading with Angular Tree Control http://tyru.github.io/angular-tree-control-test/
angular.module('tyru', ['treeControl'])
.controller('MainCtrl', ['$http', '$timeout', function ($http, $timeout) {
var ctrl = this;
ctrl.loadingTime = 1500;
ctrl.treeModel = [];
ctrl.treeOptions = {
dirSelectable: false, // Click a folder name to expand (not select)
isLeaf: function isLeafFn(node) {
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {