Skip to content

Instantly share code, notes, and snippets.

// Gruntfile.jsの一部
karma: {
options: {
files: [
grunt.option('specfile') || '<%= path.js %>/**/*_spec.js'
]
}
}
// 悪い例
$(el).html($('<span class="foo">' + value + '</span>');
// 良い例
$(el).html($('<span class="foo">').text(value));
// 要素の生成
document.write("...")
element.innerHTML = "..."
// 属性の設定
element.setAttribute(name, value)
element.someAttribute = "..." // someAttributeはhref,onclick,style,srcなど
// URL操作
location.href = "..."
// 悪い例
location.href = '/k/1234/show?param=' + param;
// 良い例
location.href = '/k/1234/show?param=' + encodeURIComponent(param);
// 悪い例
element.innerHTML = '<span class="foo">' + value + '</span>';
// 良い例
element.innerHTML = '<span class="foo">' + escapeHtml(value) + '</span>';
function escapeHtml(str) {
str = str.replace(/&/g, '&amp;');
str = str.replace(/</g, '&lt;');
str = str.replace(/>/g, '&gt;');
str = str.replace(/"/g, '&quot;');
str = str.replace(/'/g, '&#39;');
return str;
}
@ama-ch
ama-ch / gist:11161193
Last active August 29, 2015 14:00
Set focus when edit page is shown.
kintone.events.on('app.record.edit.show', function(evt) {
var elem = $('#record-gaia').find('.target-element');
elem.focus();
});
echo hoge

Markdown Table

foo bar baz
aaaa bbbb cccc
aaaa bbbb cccc
aaaa bbbb cccc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases