Skip to content

Instantly share code, notes, and snippets.

Interactive Machine Learning

Taught by Brad Knox at the MIT Media Lab in 2014. Course website. Lecture and visiting speaker notes.

@derwiki
derwiki / README.md
Last active September 27, 2023 17:50
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@rmm5t
rmm5t / OUTPUT.md
Last active February 19, 2021 21:18
How to properly introduce a new counter_cache to an existing Rails project.

Fast/efficient approach:

-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
   -> 1.3197s

Slow/naïve approach:

@RickCarlino
RickCarlino / classifier.rb
Created April 5, 2015 03:21
Using the Ruby 'classifier' gem to categorize a quote as "Ben Franklin" or "Paris Hilton"
require 'classifier'
robot_overlord = Classifier::Bayes.new 'hilton', 'franklin'
robot_overlord.train_hilton("The only rule is don't be boring and dress cute wherever you go. Life is too short to blend in.")
robot_overlord.train_hilton("The way I see it, you should live everyday like its your birthday.")
robot_overlord.train_hilton("No matter what a woman looks like, if she's confident, she's sexy.")
robot_overlord.train_hilton("I'd imagine my wedding as a fairy tale... huge, beautiful and white.")
robot_overlord.train_hilton("There's nobody in the world like me. I think every decade has an iconic blonde, like Marilyn Monroe or Princess Diana and, right now, I'm that icon.")
robot_overlord.train_hilton("Some girls are just born with glitter in their veins.")
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@gbuesing
gbuesing / ml-ruby.md
Last active February 28, 2024 15: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

@beathyate
beathyate / ruby2_rails4_os_x_mavericks.md
Last active December 29, 2015 09:39
Instalación de Ruby 2.1 y Rails 4.1 en OS X Mavericks

1. Instala Xcode a través del Mac App Store

2. Abre Terminal.app y ejecuta

xcode-select --install

3. Acepta el prompt que sale y espera a que termine de instalar.

/*globals MyApp*/
MyApp.ColorPicker = SC.PickerPane.design({
layout: { width: 250, height: 195 },
theme: "popover",
contentView: SC.WorkspaceView.design({
topToolbar: SC.ToolbarView.design({
layout: { top: 0, left: 0, right: 0, height: 32 },
childViews: "label colorSwatch".w(),
var B = {
foo: function (original) {
console.log("Foo B");
original();
}.enhance()
};
var C = {
foo: function () {
console.log("Foo C");
[submodule "sproutcore-examples"]
path = sproutcore-examples
url = git://github.com/rklancer/sproutcore-examples.git