Skip to content

Instantly share code, notes, and snippets.

View regonn's full-sized avatar
🍵
Tea.

regonn regonn

🍵
Tea.
View GitHub Profile
@regonn
regonn / gist:89cc08033e56800da3cd
Created October 6, 2014 08:22
Herokuアプリの権限のあるユーザを一覧で表示
# 実行前に下の設定が必要です
# $ rbenv exec gem install heroku-api
# $ export HEROKU_API_KEY=your_heroku_api_key
require 'heroku-api'
heroku = Heroku::API.new
apps = heroku.get_apps.body
apps.each do |app|
puts app['name']
collaborators = heroku.get_collaborators(app['name']).body
<figure>
<img src="/img/photo.jpg">
<figcaption>Lorem ipsum dolor sit amet</figcaption>
</figure>
figure {
display: table;
width: 160px; /* minimum width */
*width: auto; /* for IE7 and below */
}
@regonn
regonn / sample.jade
Created October 10, 2013 03:01
外注したコードに残っていた謎のコード
- var height = 300
- if (i % 3 == 1)
- height = 400
- if (i % 3 == 2)
- height = 500
- height = 300
@regonn
regonn / route.rb
Created November 6, 2013 05:50
config/routes.rb
Sample::Application.routes.draw do
resources :items
end
@regonn
regonn / routing
Created November 6, 2013 06:00
rake routesでrouting確認
Prefix Verb URI Pattern Controller#Action
items GET /items(.:format) items#index
POST /items(.:format) items#create
new_item GET /items/new(.:format) items#new
edit_item GET /items/:id/edit(.:format) items#edit
item GET /items/:id(.:format) items#show
PATCH /items/:id(.:format) items#update
PUT /items/:id(.:format) items#update
DELETE /items/:id(.:format) items#destroy
class ItemsController < ApplicationController
before_action :set_item, only: [:show, :edit, :update, :destroy]
def index
@items = Item.all
end
def show
end
class CreateItems < ActiveRecord::Migration
def change
create_table :items do |t|
t.string :name
t.integer :price
t.text :description
t.timestamps
end
end
<h1>Listing items</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Description</th>
<th></th>
<th></th>
json.array!(@items) do |item|
json.extract! item, :name, :price, :description
json.url item_url(item, format: :json)
end