Skip to content

Instantly share code, notes, and snippets.

@ngauthier
ngauthier / application_controller.rb
Created June 12, 2014 14:49
Squeaky: Ultralight Exception Notification and General Notifier
class ApplicationController < ActionController::Base
rescue_from StandardError, with: :handle_exception
def squeak(*args)
SqueakyMailer.notification(*args).deliver
end
def handle_exception(e)
squeak(
message: "Error: #{e.message}",
@ngauthier
ngauthier / scraping.rb
Last active March 1, 2017 13:29
Scraping the Web with Ruby Code
#!/usr/bin/env ruby
# From: http://ngauthier.com/2014/06/scraping-the-web-with-ruby.html
require 'capybara'
require 'capybara/poltergeist'
require 'csv'
require 'gdbm'
class NickBot
include Capybara::DSL
@ngauthier
ngauthier / bink.rb
Created March 31, 2014 14:08
Bink CLI Example
#!/usr/bin/env ruby
require_relative '../config/environment'
Bundler.require :bot
name = ARGV[1]
csv = "#{name}.csv"
bot = Bink.new csv
command = ARGV[0]
@ngauthier
ngauthier / reportable.rb
Last active December 28, 2015 22:09
Reportable Concern
module Reportable
extend ActiveSupport::Concern
module ClassMethods
# Chain on a scope and specify the fields to extract.
# Example:
# User.enabled.report %{
# :email_opt_in,
# 'created_at as sign_up_date'
# }
@ngauthier
ngauthier / README.md
Last active December 27, 2015 11:59
Micro tooltip lib

Micro Tooltip

Things it does:

  • a tooltip on hover
  • hide on mouseout
  • hide if you hover the tip itself
  • unobtruscive javascurpt

Configuration:

@ngauthier
ngauthier / index.html
Last active December 20, 2015 00:09
Backbone Scaffold
<!doctype html>
<html>
<head>
<title>Backbone Scaffold</title>
<script src="http://code.jquery.com/jquery-2.0.3.js"></script>
<script src="http://underscorejs.org/underscore.js"></script>
<script src="http://backbonejs.org/backbone.js"></script>
<script>
$(function() {
var Things = Backbone.Collection.extend({})
@ngauthier
ngauthier / brew-doctor.log
Created June 16, 2013 22:08
icu4c failed to build on OS X 10.9
$ brew doctor
Warning: Your file-system on / appears to be CaSe SeNsItIvE.
Homebrew is less tested with that - don't worry but please report issues.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
@ngauthier
ngauthier / scratch.html
Last active December 14, 2015 16:19
Nick's quick html and css scratchpad
<!DOCTYPE html>
<html lang="en">
<head>
<title>Nick's Style Scratchpad</title>
<style>
html, body {
margin: 0;
padding: 0;
}
.editor, #output {
@ngauthier
ngauthier / README.md
Last active December 8, 2023 13:56
install ruby 2.0.0-p0 on ubuntu
@ngauthier
ngauthier / download-modern-ie-linux.sh
Created February 1, 2013 16:54
download all modern.ie images for linux + virtualbox
#!/bin/bash
wget -c http://virtualization.modern.ie/vhd/IEKitV1_Final/VirtualBox/Linux/{IE6_WinXP,IE7_Vista,IE8_Win7,IE9_Win7,IE10_Win8}.zip