小编Noo*_*ter的帖子

bootstrap断点...需要一些澄清'xs sm md lg'

所以..在网上看,我看到一些最近的文章说明xs断点是480px及以下..其他..状态767及以下..

我有理解(可能不正确)xs适用于手机(480px及以下),.col-sm适用于平板电脑(480 px至767px)等.

但是,当我申请.hidden-xs时 - 它似乎隐藏在我期望我的平板电脑视图的位置......在480px到767范围内......

我在这做错了什么?

列以480px对齐堆叠,但.hidden功能和.col-xs似乎在该屏幕宽度处没有变化.

我正在使用一些疯狂的遗留代码,但我相当确定我已升级到最新版本的bootstrap.

css twitter-bootstrap twitter-bootstrap-3

24
推荐指数
1
解决办法
3万
查看次数

如何将base64映像从客户端传输到服务器或从s3存储桶下载二进制文件/ base64?

在我的应用程序中,我将照片直接从客户端发送到s3,使用类似于建议的heroku推荐:https://devcenter.heroku.com/articles/s3-upload-node

主要的好处是它节省了服务器成本(我假设因为没有使用诸如multipart-y表单数据之类的东西将块发送到服务器).

但是,我希望能够将这些图像分享到Twitter,其中说明了这一要求:

确保POST是multipart/form-data请求.上传文件的原始二进制文件(媒体参数)或其base64编码的内容(media_data参数).尽可能使用原始二进制文件,因为base64编码会导致更大的文件大小

我已经尝试将客户端s3上传所需的base64发送回服务器,但是根据照片大小 - 我经常收到一个错误,它太大而无法发回.

TLDR

我是否需要使用mulitparty/multipart表单数据将照片发送到我的服务器,这样我就可以使用所需的base64 /二进制文件将照片分享给twitter,还是可以继续将照片从我的客户端发送到s3?

然后,不知何故,在服务器上有效地获得所需的base64 /二进制文件(可能使用请求模块),然后我可以将图像发送到twitter?

twitter base64 multipartform-data amazon-web-services node.js

9
推荐指数
1
解决办法
923
查看次数

构建我的mongoose模式的最佳方法:嵌入式数组,填充,子文档?

这是我目前的架构

牌:

var mongoose = require('mongoose');

var Schema = mongoose.Schema;

var BrandSchema = new mongoose.Schema({
  name: { type: String, lowercase: true , unique: true, required: true },
  photo: { type: String , trim: true},
  email: { type: String , lowercase: true},
  year: { type: Number},
  timestamp: { type : Date, default: Date.now },
  description: { type: String},
  location: { },
  social: {
    website: {type: String},
    facebook: {type: String },
    twitter: {type: String },
    instagram: {type: String }
  }
});
Run Code Online (Sandbox Code Playgroud)

样式: …

mongoose mongodb nosql node.js

8
推荐指数
1
解决办法
912
查看次数

响应式视口字体在移动设备/ ios设备上不一致

在做了一些研究之后,我选择使用大众单位来扩展我的响应式排版.

%meta{:content => "width=device-width, initial-scale=1, user-scalable=0", :name => "viewport"}/
Run Code Online (Sandbox Code Playgroud)

CSS:

html{
  font-size: 1vw;
}

// h4 tag above form
h4{
  font-size: 1.60rem;
  text-align: center;
}

//form width
.e2ma_signup_form {
        margin: 0 auto;
        width: 36rem;
}

@media screen and (max-device-width: 480px){
  html , body{
    -webkit-text-size-adjust: none;
  }
}
Run Code Online (Sandbox Code Playgroud)

上面显示了我如何将根设置为1vw,然后我在表单上方有一个h4标签.

在桌面上,我在h4标签中的文本长度与表单的宽度相匹配(如下图所示).

我的问题是,在ios上,字体似乎没有以相同的方式计算.最明显的是,h4标签超出了表单的宽度.似乎在Android上正常工作.

可能导致这种情况的原因,我该如何解决?

在桌面/ chrome模拟器上(正确对齐iphone 6). 在桌面/ chrome模拟器上在桌面/ chrome模拟器上

在ios safari和chrome上 在ios上,包括safari和chrome

在ios,safari和chrome上

css viewport font-size fluid-layout responsive-design

6
推荐指数
1
解决办法
913
查看次数

为什么mongoosastic populate/elastic搜索没有填充我的一个引用?我得到一个空物

我有两个模型,我试图参考.风格和品牌.

Brand填充了所需的对象,但Style始终为空.

我已经尝试清除缓存/删除索引.有和没有include_in_parent和类型:'嵌套'.

我觉得它可能与指定的es_type等有关.不确定.


产品架构:

var mongoose = require('mongoose');
    var Schema = mongoose.Schema;
    var Style = require('./style');
    var Brand = require('./brand');
    var mongoosastic = require('mongoosastic');


    var ProductSchema = new mongoose.Schema({
      name: { type: String, lowercase: true , required: true},
      brand: {type: mongoose.Schema.Types.ObjectId, ref: 'Brand',
             es_type:'nested', es_include_in_parent:true},
        style: {type: mongoose.Schema.Types.ObjectId, ref: 'Style',
            es_schema: Style, es_type:'nested', es_include_in_parent: true},    
            year: { type: Number }
    });

    ProductSchema.plugin(mongoosastic, {
      hosts: [
        'localhost:9200'
      ],
      populate: [
        {path: 'style'},
        {path: 'brand'}
      ]
    });

    Product = module.exports = …
Run Code Online (Sandbox Code Playgroud)

mongoose node.js elasticsearch mongoosastic

6
推荐指数
1
解决办法
2417
查看次数

$ inc follower count,或者我应该使用聚合来跟踪它们?

我通过无限卷轴一次装入12个大块的产品.

有时,我可能想根据他们有多少粉丝对这些进行排序.

以下是我如何跟踪每个产品有多少粉丝.


由于16mb的数据上限,以下是单独的集合,并且下面的数量应该是无限的.

遵循架构:

var FollowSchema = new mongoose.Schema({
    user: {
        type: mongoose.Schema.ObjectId,
        ref: 'User'
    },
    product: {
        type: mongoose.Schema.ObjectId,
        ref: 'Product'
    },
    timestamp: {
        type: Date,
        default: Date.now
    }
});
Run Code Online (Sandbox Code Playgroud)

遵循架构的产品:

var ProductSchema = new mongoose.Schema({
    name: {
        type: String,
        unique: true,
        required: true
    },
    followers: {
        type: Number,
        default: 0
    }
});
Run Code Online (Sandbox Code Playgroud)

每当用户关注/取消关注产品时,我都会运行此功能:

ProductSchema.statics.updateFollowers = function (productId, val) {
    return Product
        .findOneAndUpdateAsync({
            _id: productId
        }, {
            $inc: {
                'followers': val
            }
        }, {
            upsert: true,
            'new': true …
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb node.js

6
推荐指数
1
解决办法
260
查看次数

如何设置唯一的 aws S3 文件名?

我正在通过前端将我的文件发送到 s3 存储桶,因为从我读过的内容来看,这似乎更有效。

但是,对于我的一些模式/集合,我不会有与文件/照片相关联的 ID——因为它们是在上传的同时创建的:

  $scope.add = function(){

  if($scope.file.photo){
      $scope.distiller.photo = 'http://s3.amazonaws.com/whiskey-upload/distillers/' 
      + ' needs to be assigned to guid or collection id'
        Distillery.create($scope.distiller).then(function(res){
          console.log(res);
          $scope.distillers.push(res.data.distiller);
      var files = $scope.file;
      var filename = files.photo.$ngfName;
      var type = files.type;
      var folder = 'distillers/';

      var query = {
          files: files,
          folder: folder,
          filename: res.data.distiller._id,
          type: type
        };

        Uploads.awsUpload(query).then(function(){
          $scope.distiller = {};
          $scope.file = {};
        });
    });
  }
  else{
    Distillery.create($scope.distiller).then(function(res){
      toastr.success('distillery created without photo');
      $scope.distiller = {};
    });
  }
  };
Run Code Online (Sandbox Code Playgroud)

上面的代码不起作用,除非我在创建 distillery 对象并且将文件上传到 …

amazon-s3 mongoose amazon-web-services angularjs

3
推荐指数
1
解决办法
4989
查看次数