This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 = "[email protected]: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 hidden or 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 hidden or 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 UserHighScore < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :high_score_partition | |
attr_accessible :score | |
after_save do | |
partition = HighScorePartition.where("(min < ? AND ? > max)", self.score, self.score).first("LOCK IN SHARE MODE") | |
# Not partition if cheet? | |
raise "Score not range partition" unless partition | |
# Not modify | |
return true partition.id == self.high_score_partition.id |
This file contains hidden or 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
@near_blocks = [] | |
@cost = nil | |
def nears(i,j) | |
[[i-1,j],[i+1,j],[i,j-1],[i,j+1]] | |
end | |
def near_astar map_sizes, ignores, target, current | |
x = current[:x] | |
y = current[:y] |
This file contains hidden or 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
MAP_MIN = 0 | |
MAP_MAX = 3000 | |
BLOCK_SIZE = 10 | |
DEBUG = false | |
# [level1_rate, level2_rate, ...] | |
RATE = [ | |
25, | |
20, | |
15, | |
11, |
This file contains hidden or 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 'flickraw' | |
require 'open-uri' | |
require 'exifr' | |
class ConnectionAdapter | |
def connection | |
FlickRaw.api_key = "" | |
FlickRaw.shared_secret = "" | |
flickr.access_token = "" | |
flickr.access_secret = "" |
This file contains hidden or 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 | |
class A { | |
public function getA() { | |
return "A"; | |
} | |
} | |
function getA() { | |
return "A"; |