Homebrew people have since included this in a recipe.
$ brew update
$ brew install mongodb
( follow the instructions given )
| # stick it in your ~/.pryrc | |
| # use 'xsel' or 'xclip' if you're in a Linux environment | |
| # | |
| def _cp(obj = Readline::HISTORY.entries[-2], *options) | |
| if obj.respond_to?(:join) && !options.include?(:a) | |
| if options.include?(:s) | |
| obj = obj.map { |element| ":#{element.to_s}" } | |
| end | |
| out = obj.join(", ") | |
| elsif obj.respond_to?(:inspect) |
| namespace :db do | |
| desc "load data from csv" | |
| task :load_csv_data => :environment do | |
| require 'fastercsv' | |
| FasterCSV.foreach("importdata/tarife.csv", :headers => true, :col_sep => ',') do |row| | |
| Anbieter.find_or_create_by_name( | |
| :name => row['Anbieter_Name'] | |
| :hotline => row['Hotline'], | |
| :email => row['Email'] |
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
| # - a browser with WebSocket support | |
| # | |
| # Usage: | |
| # ruby redis_pubsub_demo.rb | |
| # |
| require 'active_support' | |
| DEPLOY_CONFIG = YAML::load(File.open("config/deploy.yml")) | |
| default_run_options[:pty] = true | |
| # | |
| # General Deployment settings | |
| # | |
| set :application, DEPLOY_CONFIG['application'] | |
| set :repository, DEPLOY_CONFIG['repository'] || 'master' | |
| set :scm, :git |
| set :rails_env, :production | |
| set :unicorn_binary, "/usr/bin/unicorn" | |
| set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
| set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |
| <skm> what happens if you have more data then you do ram | |
| <ronr_> your machine explodes! | |
| <ronr_> you can use it for remote sabotage that way. |
| require 'rubygems' | |
| require 'rack' | |
| class Object | |
| def webapp | |
| class << self | |
| define_method :call do |env| | |
| func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
| [200, {}, send(func, *attrs)] | |
| end |
| user app; | |
| worker_processes 2; | |
| error_log /home/app/logs/nginx.error.log info; | |
| events { | |
| worker_connections 1024; | |
| } | |
| module CML2 | |
| # Includes to ProductCategory model | |
| module ProductCategory | |
| def import node_set | |
| ::ProductCategory.delete_all | |
| ::ProductCategory.import_categories \ | |
| node_set.xpath('/КоммерческаяИнформация/Классификатор/Группы') | |
| end |