我使用ruby gem formatize来解析我的markdown- formated文本.现在我想将一个youtube-video嵌入到markdown文本中,但每当我添加iframe片段时,gem(或markdown?)只是将它从输出中删除.任何建议?
谢谢!
我使用快递js框架.我有一个来自数据库的markdownified字符串,并希望在我的jade模板中将其呈现为HTML.我安装了node-markdown并希望以这种方式呈现它:
app.js
var md = require("node-markdown").Markdown;
Run Code Online (Sandbox Code Playgroud)
template.jade
- each note in todo.notes
div= md(note.string)
Run Code Online (Sandbox Code Playgroud)
但是,它没有打印出任何东西......有什么建议吗?
谢谢!
编辑:我自己解决了,只是忘了把md变量放到我的视图中......
我想基于它的api实现谷歌地图.我想基于坐标添加路径.因此,我从我的模型中获取坐标,并希望迭代对象以使用此点填充地图.在我的玉模板中,我包含这样的api js代码:
script(type='text/javascript')
function initialize() {
var myLatLng = new google.maps.LatLng(0, -180);
var myOptions = {
zoom: 3,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var flightPlanCoordinates = [
- if (typeof(pins) != null)
- var.pins.forEach(function(pin) {
new google.maps.LatLng(pin.latitude, pin.longitude),
- })
new google.maps.LatLng(0,0)
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
}
div#map_canvas(style='height: 500px; background-color: #990000;')
Run Code Online (Sandbox Code Playgroud)
问题是:jade渲染这个片段
var flightPlanCoordinates = [
- if (typeof(pins) != null)
- …Run Code Online (Sandbox Code Playgroud) 有人能告诉我如何扩大UIButton触摸范围吗?按钮应该按比例放大10%.
提前致谢!
打印浮动时,红宝石打印1234.0后只有一个浮动0.我怎么能强迫红宝石打印两个0?
我尝试创建一个自定义用户模型,用于向用户添加一些自定义字段.我在django 1.5中使用了基于AbstractBaseUser的新方法.除管理员面板外,一切(登录)都有效.登录管理界面时,出现以下错误:
AttributeError at /admin/
'ShopUser' object has no attribute 'is_superuser'
Run Code Online (Sandbox Code Playgroud)
这是我的模特:
from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from django.contrib import auth
class ShopUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError("We need an e-mail here...")
user = self.model(
email = ShopUserManager.normalize_email(email),
)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, password):
user = self.create_user(
email,
password = password,
)
user.is_admin = True
user.is_staff = True
user.save(using=self._db)
return user
class ShopUser(AbstractBaseUser):
email = models.EmailField(
verbose_name = 'e-mail …Run Code Online (Sandbox Code Playgroud) 我有一个控制器"应用程序".它由一个动作"索引"组成.现在我想添加一个名为"buy"的新动作:
def buy
respond_to do |format|
format.html
end
end
Run Code Online (Sandbox Code Playgroud)
我在视图中添加了buy.html.erb,但在浏览/ apps/buy时,我收到以下消息:
Unknown action - The action 'show' could not be found for AppsController
Run Code Online (Sandbox Code Playgroud)
在路线中我添加了这个:
match '/apps/buy', :controller => 'apps', :action => 'buy'
Run Code Online (Sandbox Code Playgroud)
提前致谢!
有人知道为什么我的rails 3.0.7 cli这么慢?当我跑步rails s或者rails g需要5秒时才实际执行命令......
任何建议?谢谢
ruby performance ruby-on-rails command-line-interface execution
我想知道为什么mongoid在我想读出created_at日期时返回一个字符串?我的问题是:当我想打印这样的日期
<% @app.created_at.strftime("%m/%d/%y") %>
Run Code Online (Sandbox Code Playgroud)
铁路正在提高
undefined method `getlocal' for "Wed, 11 Jul 2012 02:39:24 -0400":String
Run Code Online (Sandbox Code Playgroud)
错误.那么我该怎么办才能让mongoid将日期作为Time对象返回?
提前致谢!
我为我的登录分配了不同的布局,并在application_controller中注册视图,如下所示:
layout :layout_by_resource
def layout_by_resource
if devise_controller? && resource_name == :user && action_name == 'new'
"login"
else
"application"
end
end
Run Code Online (Sandbox Code Playgroud)
进入登录或注册信息时,它完美无缺.但是在注册时存在验证错误,标准应用程序布局会被渲染.我有什么错误吗?
谢谢!
express ×2
markdown ×2
node.js ×2
ruby ×2
action ×1
animation ×1
controller ×1
decimal ×1
devise ×1
django ×1
embedding ×1
execution ×1
gem ×1
ipad ×1
iphone ×1
javascript ×1
mongoid ×1
parsing ×1
performance ×1
pug ×1
render ×1
routes ×1
scale ×1
templates ×1
uibutton ×1
views ×1
youtube ×1
zero ×1