require

google-api-php-client's autoloader deprecated

江枫思渺然 提交于 2019-12-22 18:36:40
问题 As a test, I ran one line of code in PHP to implement the PHP Client Library. indexTest.php <?php require_once realpath(dirname(__FILE__).'/google-api-php-client/autoload.php'); return; I get this error: Deprecated: google-api-php-client's autoloader was moved to src/Google/autoload.php in 1.1.3. This redirect will be removed in 1.2. Please adjust your code to use the new location. in C:\Users\NoName\Documents\academic-being-90217\google-api-php-client\autoload.php on line 25 What do I need

Handling dependencies not installed with npm, in Mocha?

£可爱£侵袭症+ 提交于 2019-12-22 11:03:30
问题 I have a working Node application and I'm trying to add Mocha tests, but getting some odd import errors. This is my file structure: package.json index.js src/ chart.js test/ test_chart.js This is what my chart.js file looks like: global.jQuery = require('jquery'); global.$ = global.jQuery; require('typeahead'); require('bloodhound'); var bootstrap = require('bootstrap'); var Handlebars = require('handlebars'); var Highcharts = require('highcharts-browserify'); var parse = require('csv-parse')

If I use `module(“somelib”)` in typescript, it can't be running in browser

一世执手 提交于 2019-12-22 09:19:56
问题 I'm trying to use typescript with angularjs in the client-side. I found if I use external modules, the generated js won't be run in browser. controllers.ts /// <reference path="./libs/underscore.d.ts"/> import _ = module("underscore"); module test { export class Ctrl { constructor($scope:any) { $scope.name = "Freewind"; _.each($scope.name, function(item) {}); } } } The generated js will be: var _ = require("underscore") var test; (function (test) { var Ctrl = (function () { function Ctrl(

Does the Ruby rescue statement work with require?

一个人想着一个人 提交于 2019-12-22 08:48:33
问题 Does the Ruby rescue statement modifier work with require ? irb(main):001:0> require 'a' rescue nil LoadError: no such file to load -- a from (irb):1:in `require' from (irb):1 from :0 回答1: You can rescue from a LoadError you just need to use the begin/end style and not use the inline rescue : This works as you expect: begin require 'a' rescue LoadError => ex puts "Load error: #{ex.message}" end 来源: https://stackoverflow.com/questions/12750546/does-the-ruby-rescue-statement-work-with-require

cordova-plugin-crypt-file - requireCordovaModule error

佐手、 提交于 2019-12-22 04:38:08
问题 I just upgrade Cordova to version 9. It cased plugin cordova-plugin-crypt-file to stop working - when I build the application, I get error Using "requireCordovaModule" to load non-cordova module "path" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. It looks like the issue is with file hooks/after_prepare.js. The code is var path = context.requireCordovaModule('path'), fs = context.requireCordovaModule('fs'), crypto = context

Browserify require returns an empty object

北城以北 提交于 2019-12-22 01:24:53
问题 I have this code which, for reasons I can't understand, produces an empty object when using require() . My file structure is like this: src |__ public |__ javascript |__ collections | categories.js | listings.js <-- Always an empty object |__ models | category.js | employer.js | listing.js | location.js | routing | templates | tests | ui-components | views The problem file is collections/listings.js , which seems to simply output as an empty object when required like so: var

Rails lib directory

风格不统一 提交于 2019-12-22 01:13:03
问题 Question about lib directory. What are good practices in using the lib directory? When should it be used over app/models or app/helpers? And somewhat related how do you get Rails 3 to include files from the lib directory? Thanks 回答1: One use of the lib directory (how I use it most often) is to share code between models to stay DRY. For example, if you are defining a tag_tokens attribute on many different models for use with a tokenizer input, you could put that in "tag_accessor.rb" or

《NodeJS开发指南》第五章微博实例开发总结

余生长醉 提交于 2019-12-21 20:51:48
所有文章搬运自我的个人主页: sheilasun.me 《NodeJS开发指南》 这本书用来NodeJS入门真是太好了,而且书的附录部分还讲到了闭包、this等JavaScript常用特性。第一遍看的时候很多地方没看明白,再看一遍的时候就清晰多了。跟着书上第五章完成了微博实例Microblog,在此总结一下开发中遇到的问题。这本书出得较早(2012年出版),因此书中的express框架部分与新的Express 4.x也有些不同,下文都将会提到,并给出新的写法。 Microblog是一个出于学习目的设计的简单微博系统,核心功能是发表信息,其他功能包括用户的注册及登入登出等。 安装 着手开发之前先搭建一下环境吧! 安装 NodeJS 去 NodeJS官网下载页面 上根据自己的操作系统下载对应的安装包并安装之后,我们就有了NodeJS和npm环境。npm是Node的包管理工具,会在安装NodeJS时一并安装。可以用以下命令查看版本号验证我们的安装成功与否: sunjingdeMacBook-Pro:microblog sunjing$ node -v v0.12.2 sunjingdeMacBook-Pro:microblog sunjing$ npm -v 2.7.4 安装 express-generator 我们使用express作为开发框架,与书上不同的是

Express 4.x Node.js的Web框架

左心房为你撑大大i 提交于 2019-12-21 14:22:27
为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处。LaplaceDemon/SJQ。 http://www.cnblogs.com/shijiaqi1066/p/3821150.html 本文使用node.js v0.10.28 + express 4.2.0 1 Express概述 Express 是一个简洁而灵活的node.js的MVC Web应用框架,提供一系列强大特性创建各种Web应用。 Express 不对 node.js 已有的特性进行二次抽象,我们只是在它之上扩展了Web应用所需的功能。 Expressd底层由Node.js的HTTP模块实现。 1.1 express 4.x 安装 express 4.x与之前的版本有了许多的变化,书里和网上的很多方法都不再适用。学习需要更多的参考官方文档。 若需要用express 3.x版本,直接使用nmp 中的@字符确定版本,指令如下: npm install -g express-generator@3 若需要使用4.x,注意的问题在4.x版本express 已经把命令行工具分离出来。 现在全局安装只需要安装这个命令行工具就可以,指令如下: npm install -g express-generator 1.2 创建express工程 使用express命令 express [options] 选项: -h, -

require a module with webpack

ε祈祈猫儿з 提交于 2019-12-21 07:22:10
问题 I use Webpack in order to build my javascript of my website. Everything work perfectly but I would like to call require into a template (added dynamically). I want to be able to require a module after the build. (require is not defined into the global context). Is it possible ? Thx 回答1: An option which is available to you now is to create a context which you expose globally on window . I've had success using the following snippet: // Create a `require` function in the global scope so that