https://github.com/roine/p1/tree/gh-pages这是gh-pages分支上的我的github存储库.一切都很好看,我有我的index.html,我的CSS,js和图片文件夹.
但是当我访问http://roine.github.com/p1时,我有404页.
任何解释和解决方案?
我从Meteor开始,我想知道如何列出已安装的软件包.
meteor list 只列出注册表中的可用包.
编辑:由于meteor 0.9.0.1 meteor list列出了项目中的可用包.
我有一个好帮手
Template.user_profile.helpers({
user:function() {
return Meteor.users.find({'profile.front_name':Session.get('slug')}).fetch()[0];
}
});
Run Code Online (Sandbox Code Playgroud)
我想在集合中添加一个帮助程序,它可以访问user帮助程序并将其_id与当前用户进行比较_id,以判断用户是否正在访问自己的配置文件.我正在使用一些非常难看的东西:
Template.user_profile._tmpl_data.helpers.user()
Run Code Online (Sandbox Code Playgroud)
最终代码:
Template.user_profile.helpers({
user:function() {
return Meteor.users.find({'profile.front_name':Session.get('userId')}).fetch()[0];
},
isCurrentUser: function() {
return Template.user_profile._tmpl_data.helpers.user()._id === Meteor.userId();
}
});
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来访问另一个帮手?
我需要并行使用两个状态,一个用于我的页面,另一个用于具有多个子状态的模态.现在调用模态状态将消除我的页面,因为页面状态已更改.
创建我的页面的子状态子项将不是解决方案,因为模式将在多个页面上使用.
例:
$stateProvider
.state('user', {}) // page
.state('bookshelf', {}) // page
.state('books', {}) // modal
.state('books.read', {}) // sub state of modal
Run Code Online (Sandbox Code Playgroud)
因此,如果我user打开并打开我的模态然后状态将更改为books,我的模态将具有内容但页面内容将被删除.
我如何解决它?
我总是混淆我是否应该在路径的末尾添加一个尾部斜杠,并经常将其混合,导致找不到某个文件.drupal示例:
$base_theme = '/sites/all/themes/myTheme/';
Run Code Online (Sandbox Code Playgroud)
要么
$base_theme = '/sites/all/themes/myTheme';
Run Code Online (Sandbox Code Playgroud)
图像路径可以扩展基本主题:
$base_image = $base_theme.'images/';
Run Code Online (Sandbox Code Playgroud)
要么
$base_image = $base_theme.'/images';
Run Code Online (Sandbox Code Playgroud)
有没有约定?或者我可以选择哪一个我更喜欢?
我会选择用尾随斜杠完成所有路径,因为太多斜线比没斜线更好.
if([] == false) alert('empty array is false');
alert(+[]) // alert 0
if([]) alert('empty array is true');
Run Code Online (Sandbox Code Playgroud)
他们都将运行警报
我把一个mouseleave和一个mouseenter事件附加到一个容器上.这个容器包含一个选择和一些随机文本,我将鼠标放在容器上,然后点击选择,这是Chrome和IE 10上发生的情况:
Chrome:没有触发mouseleave(这就是我想要的)

我正在寻找一种交叉浏览解决方案,只有当我的鼠标没有悬停在容器及其子容器上时才会触发事件.
javascript internet-explorer javascript-events internet-explorer-10
如何检查表中的字段是否设置为UNIQUE?
例如,我有一个名为users字段email设置的表UNIQUE和一个picture未设置为的字段UNIQUE,我想在选择之前检查字段是否设置为UNIQUE如果没有设置,则不要这样做SELECT.
我试着SELECT然后计算返回的行数,如果超过1那么它不是UNIQUE,
"SELECT * FROM table WHERE email='$email'"
//...some mysql php line later
if($count > 1){
//return nothing
}
Run Code Online (Sandbox Code Playgroud)
但它没有效率,如果没有重复就会怎么样.
什么是检查一个字段是否被设置为最佳方式UNIQUE的PHP?
编辑:没有重复并不意味着它UNIQUE有财产
是否有区别:
(function(){
}).call(this);
Run Code Online (Sandbox Code Playgroud)
和
(function(){
})();
Run Code Online (Sandbox Code Playgroud)
要么
var MODULE = {};
(function(){
this.hello = 'world'
}).call(MODULE);
Run Code Online (Sandbox Code Playgroud)
和
var MODULE = {};
(function(m){
m.hello = 'world'
})(MODULE);
Run Code Online (Sandbox Code Playgroud)
我经常在编译的javascript中看到第一个案例.他们都会创建一个范围并做好他们的命名工作.
有什么区别或只是品味问题.
编辑:为什么编译的JavaScript将使用IIFE调用?
javascript ×5
php ×3
meteor ×2
angularjs ×1
boolean ×1
conventions ×1
eloquent ×1
github ×1
github-pages ×1
indexing ×1
meteorite ×1
mysql ×1
namespaces ×1
node.js ×1
npm ×1
orm ×1
relationship ×1
scope ×1
unique-index ×1