Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| <?php | |
| !defined('ROOT_PATH') && define('ROOT_PATH', str_replace('\\', '/', dirname(__FILE__))); | |
| ?> |
| <?php | |
| $C = array( | |
| 'URL_MODE' => 2, //URL模式, 1普通模式, 2 PATH_INFO模式 | |
| 'DEFAULT_CONTROL' => 'welcome', //默认调用的控制器 | |
| 'DEFAULT_ACTION' => 'index', //默认执行的方法 | |
| ); | |
| class Controller |
| require 'pry' | |
| class AddExternalSystemId < ActiveRecord::Migration | |
| def up | |
| Rails.application.paths["app/models"].each do |model_path| | |
| Dir["#{Rails.root}/#{model_path}/*/*.rb"].each { |file| require file } | |
| end | |
| models = ActiveRecord::Base.send(:subclasses) | |
| binding.pry |
| # coding: utf-8 | |
| require 'mechanize' | |
| Id = 'id' | |
| Password = 'password' | |
| Mechanize.new do |agent| | |
| agent.user_agent = 'Mozilla/5.0 (Linux; U; Android 2.3.2; ja-jp; SonyEricssonSO-01C Build/3.0.D.2.79) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' | |
| agent.get 'http://login.yahoo.co.jp/config/login?.lg=jp&.intl=jp&logout=1&.src=www&.done=http://www.yahoo.co.jp' |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| alias ng="npm list -g --depth=0 2>/dev/null" | |
| alias nl="npm list --depth=0 2>/dev/null" |
| class Array | |
| def same_structure_as(b) | |
| return false unless b.is_a?(Array) && self.is_a?(Array) | |
| c = self.each_with_object([]) do |c,d| | |
| if c.is_a?(Array) | |
| d << c.length | |
| else | |
| d << 1 | |
| end |
| max_stack_frames = 500 | |
| TooManyStackFrames = Class.new(StandardError) | |
| TracePoint.new(:call) do |tp| | |
| if caller.size >= max_stack_frames | |
| raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames" | |
| end | |
| end.enable |
| rvm --create 1.9.3@benchmarks |
| #script to see differents between consistently calculation and parallel calculation | |
| gem "parallel" | |
| require 'parallel' | |
| #function can compute more efficiently and I know it :) | |
| def is_prime?(num) | |
| return true if num == 1 | |
| return false if num < 1 | |
| for x in 2...num |