Skip to content

Instantly share code, notes, and snippets.

View koba04's full-sized avatar

Toru Kobayashi koba04

View GitHub Profile
@koba04
koba04 / computedBackgroundImage.js
Created May 2, 2014 10:15
Compute backgroundImage url from css class.
computedBackgroundImage: function(className) {
var div = document.createElement("div");
div.style.display = "none";
div.className = className;
document.body.appendChild(div);
var url;
var style = window.getComputedStyle(div)["background-image"];
if (style) {
var match = style.match(/^url\((.*)\)/);
@koba04
koba04 / release-note.md
Last active August 29, 2015 14:02
marionette.js 2.0 release note (translate in japanese)
describe "App.request", ->
deferred = null
beforeEach ->
deferred = $.Deferred()
sinon.stub(App, "request").returns deferred.promise()
afterEach ->
App.request.restore()
describe "App.request", ->
beforeEach ->
sinon.stub(App, "request").yieldsTo('done', {res: "ok"})
afterEach ->
App.request.restore()
it "res should be 'ok'", (done) ->
App.request(
describe "App.request", ->
beforeEach ->
sinon.stub(App, "request").yieldsTo('done', {res: "ok"})
afterEach ->
App.request.restore()
it "res should be 'ok'", (done) ->
App.request(

atom-shellとNode-Webkitとの技術的な違い

Node-Webkitのように、atom-shwllはJavaScriptとHTMLでデスクトップアプリケーションを書くダメのプラットフォームを提供します。そしてシステムのローレベルな権限へのアクセスも可能です。

しかしながら、そこには根本的な違いがあって、atom-shellはNode-Webkitとは完全に別なプロダクトになっています。

1. Entry of application

Node-WebkitはアプリケーションのエントリポイントがWebページで、package.jsonにメインページを指定します。そしてそれがアプリケーションのメインウィンドウとしてブラウザで開かれます。

Uncaught Error: Invariant Violation: You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side.
@koba04
koba04 / stores.md
Last active August 29, 2015 14:07
My ebook store accout page
diff --git a/todomvc/react/js/app.js b/todomvc/react/js/app.js
index c72cd7d..5b88cd5 100755
--- a/todomvc/react/js/app.js
+++ b/todomvc/react/js/app.js
@@ -23,7 +23,6 @@
return {
todos: todos,
nowShowing: ALL_TODOS,
- editing: null
};
class Sample extends React.Component {
getInitialState() {
return { data: this.props.initialData };
}
componentDidMount() {
if (!this.props.initialDada) {
request('/api/xxx')
.end((err, res) => {
this.setState({ data: res.body });
})