Skip to content

Instantly share code, notes, and snippets.

View apillet's full-sized avatar

Ariel Pillet apillet

  • Buenos Aires, Argentina
View GitHub Profile
cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
@gbuesing
gbuesing / ml-ruby.md
Last active December 3, 2024 08:13
Resources for Machine Learning in Ruby

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!

Resources for Machine Learning in Ruby

Gems

@wtaysom
wtaysom / where_is.rb
Created September 23, 2011 08:57
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@txus
txus / CptnRuby Gem.png
Created July 21, 2011 16:00
Game Draft
CptnRuby Gem.png
@foca
foca / factories.rb
Created November 28, 2010 01:17
All factory libraries are overengineered.
require "ffaker"
class ActiveRecord::Base
def self.define_factory(name=nil, parent=nil, &block)
name = [name, "factory"].compact.join("_")
scope name, lambda { |overrides={}|
parent ||= scoped
attributes = instance_eval(&block).merge(overrides)
parent.where(attributes)
}
#
# Draws an unfilled circle, thanks shawn24!
#
CIRCLE_STEP = 10
def draw_circle(cx,cy,r,color)
0.step(360, CIRCLE_STEP) do |a1|
a2 = a1 + CIRCLE_STEP
$window.draw_line cx + Gosu.offset_x(a1, r), cy + Gosu.offset_y(a1, r), color, cx + Gosu.offset_x(a2, r), cy + Gosu.offset_y(a2, r), color, 9999
end
end
@cyx
cyx / compel.rb
Created October 27, 2010 12:30
my attempt at simplifying my stubbing and mocking life
module Compel
extend self
def compel(obj, hash)
hash.each do |meth, value|
meta_eval(obj) { alias_method :"_COMPEL_#{meth}", meth }
block = value.is_a?(Proc) ? value : lambda { value }
meta_def(obj, meth, &block)
end
@foca
foca / state_pattern_with_micromachine.rb
Created October 14, 2010 03:33
How to use the State pattern with MicroMachine, the simplest FSM lib out there :)
# This aims to reproduce the State pattern using MicroMachine.
# We're just implementing the example from http://github.com/dcadenas/state_pattern
require "micromachine"
module Stop
def self.color
"red"
end
@foca
foca / isolated_rails.rb
Created September 24, 2010 14:11
Rails template using Isolate for dependency management. Most of the code was blatantly stolen from jbarnette
run "rm public/index.html"
file "Isolate", <<-END
gem "rails", "3.0.1"
gem "haml", "3.0.22"
gem "sqlite3-ruby", "1.3.1"
env :development do
gem "haml-rails", "0.2"
end
@soveran
soveran / go.rb
Created September 23, 2010 15:03
require "go/gtp/board"
require "cutest"
setup do
string = <<-EOS.gsub(/^ {2}/, "")
A B C D E F G H J
9 . . . . . . . . . 9
8 . . . . . . . . . 8
7 . . X . . . + . . 7
6 . . . . . . . . . 6