Use normal PHP libraries in CodeIgniter - api

I'm new to CodeIgniter and I'm trying to use the Tumblr php library; however I'm not sure how can I adapt it to work with CodeIgniter (if such thing is possible).
I managed to find a few Tumblr CI libraries but they don't provide all the methods available (like tag searching), and the most advanced by BIOSTALL only supports the v1 of the Tumblr API.
Any advices?

You need to do these steps:
Download Tumblr API library for CodeIgniter here
tumblr.php (in config folder) put on your config folder
Change the config file with your parameters:
$config['tumblr_consumer_key'] = '';
$config['tumblr_secret_key'] = '';
$config['tumblr_url'] = 'good.tumblr.com';
$config['callback_url'] = 'controller/method';
$config['auth_callback'] = 'controller/method';
Tumblr.php (in library folder) put on your library folder
OAuth.php (in third_party folder) put on your third_party (create if didn't exist).
Use it. For example:
$this->load->library('Tumblr');
$blog_info = $this->tumblr->blog_info();
// Blog info returned in object
echo $blog_info->title; // echo blog title

Related

Where to install 3rd party scripts in Nuxt?

Im trying to upload static files(images and js) from "static" folder. And it works fine for index file and base route localhost:8000/, but if I go to the next route localhost:8000/reviews/master001 then static files disappears and I receive by route localhost:8000/reviews/js. And there is two things, first is how to remove prefix "reviews"?
I tried to use in nuxt.config.js
static: {
prefix: false
}
by documentation, but it does not work. Tried to use paths in nuxt.config like "../js", "#/static/js", "/js" - this one works for index file.
Also there are no any static files after I go through the router-link such it in nuxt documentation for path localhost:8000/reviews/master001.
Here there are.
And here there no any files.
As explained in the comments above, images should be in assets and static is only aimed for specific use cases, like exposing a publicly accessible .pdf file.
If you want to install and use jQuery properly into your Nuxt project, you can follow my answer here: https://stackoverflow.com/a/68414170/8816585
If you want to load a specific script and cannot do it in a more cleaner way (with NPM), you can also follow the instructions there: https://stackoverflow.com/a/67535277/8816585
Use this as a last resort tho and be aware that it will increase bundle size and loading time.

blogdown how to ingore an Rmd file that was built previously

I am using blogdown to build my site.
For a recent post, I wanted to keep a variable (config) out of the .Rmd post itself, because config contained sensitive authentication information. If I set config globally, but not in the .Rmd file itself, calling blogdown::serve_site() failed because config was not defined in the new session serve_site() creates when rendering the markdown files.
To accomplish what I wanted, I manually rendered the .Rmd source file with config defined in the global environment by calling rmarkdown::render("path/to/post.Rmd"), as suggested in how-to-use-objects-from-global-environment-in-rstudio-markdown. This successfully built the .Rmd file and produced the correct html output.
Now, though, I am unable to use blogdown::serve_site() to automatically build new posts on my site. It continually fails on the post that does not contain the required config variable. Is there a way to ignore the offending post? Or alternatively, a better way to do this?
Just like how you set global R options for blogdown (see Section 1.4 of the blogdown book), you can create config in .Rprofile under the root directory of your website project. The R code in .Rprofile will be executed before each Rmd post is rendered.

How can I programmatically generate a file at build-time in Create React App?

I'd like for my Create React App to generate a file called VERSION.txt that will end up in my deployed site's public directory as part of its build.
I know I can just create a static file in my repo's public/VERSION.txt, but I want its contents to come from an environment variable. The ENV variable is REACT_APP_COMMIT_REF, which is coming from my Netlify setup. I'd like my CRA to put this variable in public/VERSION.txt (so my React app can easily check it to see if a new version exists), but the docs on environment variables says they're only available in index.html (as well as in any source JS code via process.env).
As a workaround for now I've put it in a meta tag in my public/index.html
<meta name="app-version" content="%REACT_APP_COMMIT_REF%" />
but my app code now has to parse this string and I'd rather just have a public/VERSION.txt to achieve this.
Is it possible for CRA to programmatically generate files at build-time?

Dropwizard serve external images directory

I have a dropwizard API app and I want one endpoint where I can run the call and also upload and image, these images have to be saved in a directory and then served through the same application context.
Is it possible with dropwizard? I can only find static assets bundles.
There is similar question already: Can DropWizard serve assets from outside the jar file?
The above module is mentioned in the third party modules list of dropwizard. There is also official modules list. These two lists are hard to find maybe because the main documentation doesn't reference them.
There is also dropwizard-file-assets which seems new. I don't know which module will work best for your case. Both are based on dropwizard's AssetServlet
If you don't like them you could use it as example how to implement your own. I suspect that the resource caching part may not be appropriate for your use case if someone replace the same resource name with new content: https://github.com/dirkraft/dropwizard-file-assets/blob/master/src/main/java/com/github/dirkraft/dropwizard/fileassets/FileAssetServlet.java#L129-L141
Edit: This is simple project that I've made using dropwizard-configurable-assets-bundle. Follow the instructions in the README.md. I think it is doing exactly what you want: put some files in a directory somewhere on the file system (outside the project source code) and serve them if they exist.

How do I generate the API docs/documentation for Magento?

I have Magento installed and I wanted to know how to generate the full API docs, like the ones on http://docs.magentocommerce.com/ that were generated using phpdoc. Is there a configuration file included with Magento for phpdoc that I can use to generate the documentation?
The actual program is called phpDocumentor and you can use it on the command-line to document the core Magento code by using phpdoc -d $MAGENTO_PATH/app/code/core/Mage/ -t docs. Don't forget get to create a directory called docs, or you can set the target directory to whatever you want.
To document the API of an extension you can use phpdoc -d $MAGENTO_PATH/app/code/local/$PACKAGE/$MODULE where $PACKAGE is the package name, and $MODULE is the name of the module, and $MAGENTO_PATH is where Magento is installed.
Warning: it could take a while to generate all the API documentation as Magento is a pretty big program.