UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!
- liblinear-ruby: Ruby interface to LIBLINEAR using SWIG
# Original Rails controller and action | |
class EmployeesController < ApplicationController | |
def create | |
@employee = Employee.new(employee_params) | |
if @employee.save | |
redirect_to @employee, notice: "Employee #{@employee.name} created" | |
else | |
render :new | |
end |
# MODEL | |
class Case < ActiveRecord::Base | |
include Eventable | |
has_many :tasks | |
concerning :Assignment do | |
def assign_to(new_owner:, details:) | |
transaction do |
class GroupersController < ApplicationController::Base | |
def create | |
@grouper = Grouper.new(leader: current_member) | |
if @grouper.save | |
ConfirmedGrouperEmails.new(@grouper).deliver | |
AssignBarForGrouper.enqueue(@grouper.id) | |
redirect_to home_path | |
else |
#!/usr/bin/env python | |
import os | |
import itertools | |
import multiprocessing as mp | |
from math import ceil | |
from types import GeneratorType as generator | |
from functools import partial | |
from time import time | |
module ActiveRecordMarshalable | |
def marshal_dump | |
[attributes, self.association_cache, instance_variable_get(:@new_record)] | |
end | |
def marshal_load data | |
send :initialize, data[0] | |
instance_variable_set :@association_cache, data[1] | |
instance_variable_set :@new_record, data[2] | |
end |
~/.chrb
, their installation inside ~/local
and my rubies at ~/.chrb/rubies
.~/.mkshrc
file# chruby + ruby-build
chrb() {
source ~/local/share/chruby/chruby.sh
unset RUBIES
RUBIES=$(ls -d ~/.chrb/rubies/* 2> /dev/null)
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
namespace :deploy do | |
# Ask whether to reindex before restarting Passenger | |
task :restart, :roles => :app, :except => {:no_release => true} do | |
solr.reindex if 'y' == Capistrano::CLI.ui.ask("\n\n Should I reindex all models? (anything but y will cancel)") | |
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}" | |
end | |
desc 'create shared data and pid dirs for Solr' | |
task :setup_solr_shared_dirs do | |
# conf dir is not shared as different versions need different configs |