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
class MaterialPermissionHandler < ApplicationPermissionHandler | |
CODE_NAMES = [ | |
:show, :update, :delete, :edit | |
] | |
def has_perm? user, code_name, object_id | |
obj = Material.find_by_id object_id | |
# Accept author. | |
return true if user == obj.user | |
case code_name |
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
user_name = "miio" | |
remote_addr = "git@github.com:miio/grit_test.git" | |
clone_args = {quiet: false, verbose: true, progress: true, branch: 'master'} | |
# Open Repository | |
central = create_or_open './storage/central/miio/grit_test/', remote_addr, clone_args | |
working = create_or_open './storage/working/miio/grit_test/', './storage/central/miio/grit_test/', clone_args | |
# Add Remote Branch | |
begin |
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
class DeviseCreateUsers < ActiveRecord::Migration | |
def change | |
create_table(:users) do |t| | |
## Trackable | |
t.integer :sign_in_count, :default => 0 | |
t.datetime :current_sign_in_at | |
t.datetime :last_sign_in_at | |
t.string :current_sign_in_ip | |
t.string :last_sign_in_ip | |
t.timestamps |
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 BulkCheck | |
class Storage | |
@@pool = [] | |
@@where_in = {} | |
@@cache = nil | |
def self.pool data | |
@@pool << data | |
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
def crawl | |
FlickRaw.api_key = "♥♥♥♥♥♥♥♥♥♥♥♥♥♥" | |
FlickRaw.shared_secret = "♥♥♥♥♥♥♥♥♥♥♥♥♥♥" | |
flickr.access_token = "♥♥♥♥♥♥♥♥♥♥♥♥♥♥-♥♥♥♥♥♥♥♥♥♥♥♥♥♥" | |
flickr.access_secret = "♥♥♥♥♥♥♥♥♥♥♥♥♥♥" | |
login = flickr.test.login | |
list = flickr.people.getPhotos :user_id => login.id | |
file = "" | |
info = [] | |
Photo.transaction do |
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
class HogeController < ApplicationController | |
before_filter :only => [:destroy] { |c| c.has_perm(current_user, 'hoge.hoge_delete') } | |
before_filter :only => [:create] { |c| c.has_perm(current_user, 'hoge.hoge_create') } | |
def create | |
# todo your logics | |
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
class Logger | |
### | |
# Loggingクラス | |
# Author : miio mitani <info@miio.info> | |
# Package : Kwing.lib | |
# Licence : GNU Lesser General Public License v3 (http://www.gnu.org/licenses/) | |
### | |
debug : (attr_name, message) -> | |
### | |
# デバッグメッセージを出力 |
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
#show hidden file | |
defaults write com.apple.finder AppleShowAllFiles -boolean true | |
killall Finder | |
#install homebrew ( for mac package system ) | |
ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" |
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
<?php | |
interface ExampleInterface{ | |
function getHoge(); | |
function getFuga(); | |
function setAge(int $age); | |
} | |
class Example implements ExampleInterface{ | |
function getHoge(){ | |
} |
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
#まずClone | |
git clone git://gitorious.org/gitorious/mainline.git | |
bundle install | |
Fetching https://github.com/roman/rots.git | |
remote: Counting objects: 253, done. | |
remote: Compressing objects: 100% (116/116), done. | |
remote: Total 253 (delta 126), reused 233 (delta 118) | |
Receiving objects: 100% (253/253), 38.58 KiB, done. |