Skip to content

Instantly share code, notes, and snippets.

  • Line 13 in CookbookUploadsController. Do we need to check if the upload is valid if we're checking if it's valid in the finish! method?
  • What value does Virtus add to CookbookUpload::Metadata that can't be achieved with accessors?
class A
  attr_accessor :b, :c, :d

  def initialize(h)
    h.each { |k, v| send("#{k}=", v) }
  end
end
require 'parslet'
recipe = <<EOH
:1 oz: @1 :60 Minutes:
:1 oz: @2 :30 Minutes:
EOH
class BierDown < Parslet::Parser
rule(:colon) { match(':') }
rule(:at) { match('@') }
irb(main):022:0> Cookbook.find_by(name: 'mysql').cookbook_versions.sort_by { |v| Semverse::Version.new(v.version) }.reverse.first
Cookbook Load (0.6ms) SELECT "cookbooks".* FROM "cookbooks" WHERE "cookbooks"."name" = 'mysql' LIMIT 1
CookbookVersion Load (2.5ms) SELECT "cookbook_versions".* FROM "cookbook_versions" WHERE "cookbook_versions"."cookbook_id" = $1 [["cookbook_id", 699]]
=> #<CookbookVersion id: 2861, cookbook_id: 699, license: "Apache 2.0", version: "4.1.2", created_at: "2014-02-28 10:27:00", updated_at: "2014-02-28 10:27:00", tarball_file_name: "mysql20140228-22364-1stzk6m", tarball_content_type: "application/x-tar", tarball_file_size: 26275, tarball_updated_at: "2014-02-28 10:26:56", readme: "mysql Cookbook\n==============\n[![Build Status](htt...", readme_extension: "md", dependencies_imported: true, description: "Installs and configures mysql for client or server", legacy_id: 6009, web_download_count: 65, api_download_count: 0, verification_state: "pending">
irb(main):023:0> Cookbook
self.navigationController.view.addConstraints([
NSLayoutConstraint(
item: add,
attribute: .Width,
relatedBy: .Equal,
toItem: add,
attribute: .Width,
multiplier: 1,
constant: 0
),

Winooski

  • Mule Bar - Good beer bar, craft cocktails and food.
  • Misery Loves Company - Amazing low class, high class food. I recommend going for lunch. Also serves some good beer and cocktails. My favorites are the Big Red, Rough Francis and the Korean Rueben.
  • Winooski Beverage Warehouse (The Bevie) - Huge bottled/can beer and wine selection. I go here pretty much on a weekly basis.

Burlington

function fish_greeting
set_color green
print_weather | cowsay
end
function print_weather
if test -f .weather
set time (head -n 1 .weather)
set current (date +%s)
set diff (math $current - $time)
require.paths.unshift(__dirname + '/modules', __dirname + '/lib/node', __dirname);
var express = require('express');
var app = module.exports = new express.Server();
app.configure(function() {
app.use(express.cookieDecoder());
app.use(express.session());
});
@tristanoneil
tristanoneil / gist:1632794
Created January 18, 2012 12:32
Importing unique data from a CSV into MySQL
LOAD DATA INFILE '/path/to/file' IGNORE INTO TABLE data.timeseries FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 LINES;
@tristanoneil
tristanoneil / gist:1711388
Created January 31, 2012 16:16
reject columns
.reject { |key, value| columns.map(&:name).include?(key) }.keys