# ルートディレクトリ
/
# ホームディレクトリ
/Users/shuhei
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'date' | |
def nap | |
sleep(3 + rand(10) / 10) | |
end | |
def org_list_item(org, i) | |
"#{i + 1}. [#{org[:name]}](#{org[:link]}): #{org[:posts]} posts, #{org[:stocks]} stocks" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paste this to Rails console. | |
def get_inner(app, middlewares) | |
middlewares << app.to_s | |
if inner = app.instance_variable_get(:@app) | |
get_inner(inner, middlewares) | |
end | |
end | |
def collect_middlewares(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('sync', []) | |
.controller('HomeController', function(Model, sync) { | |
this.toggleName = function() { | |
Model.toggleName(); | |
}; | |
sync(Model, 'getName', this, 'name'); | |
sync(Model, 'theOther', this, 'other'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
~/.rbenv/versions/2.1.2/bin/rubocop $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
div { | |
position: absolute; | |
width: 200px; | |
} | |
#wrapper { | |
background-color: #f00; |
- The methods like
element()
,element.all()
andelement().fisrt()
return element finders instead of elements. At this time, element finding is not performed yet. So the element finders are reusable even when the page state changes. - The action methods like
element().click()
,element().getText()
andelement.count()
return promises. At this time, element finding and action are not performed yet. They register actions to a queue in order. - The actions in the queue are executed one by one. When executed, element finding and the action are performed. Between actions, protractor waits for Angular to finish $digest loop and $http requests.
npm install
npm start
and save a.js.
Files are bundled twice.
This is because a.js is watched twice as a relative path and an absoulete path. The former comes from 'file' event of browserify that comes from module-deps' 'file' event. The latter comes from 'dep' event of browserify. If we use absolute paths for browserify, this problem doesn't happen. But why does watchify check 'file' and 'dep'?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ngInject | |
class AwesomeController { | |
constructor(a, b, c, d, e, f, g, h) { | |
bindArguments(this, arguments); | |
} | |
foo() { | |
this.a.doSomething(); | |
this.b.doAnotherThing(); | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api | |
class PublicApi | |
PANEL_KEYS = [ | |
:priority, | |
:template_type, | |
:title, | |
link: [ | |
:id, | |
:title, | |
:url, |