Skip to content

Instantly share code, notes, and snippets.

@paneq
paneq / rails_erb_syntax_check.rb
Last active January 9, 2018 13:34 — forked from arika/rails_erb_syntax_check.rb
Rails(Action View) ERB template syntax checker
require 'action_view'
require 'tmpdir'
require 'fileutils'
require 'optparse'
def check_syntax(path, options = {})
erb = content(path)
code = ruby_code(erb)
eval("BEGIN { puts('ok'); return true }; #{code}", nil, path, 0)
@paneq
paneq / serializer_benchmarks.rb
Created January 13, 2016 11:06 — forked from aishfenton/serializer_benchmarks.rb
Performance comparison of different ruby serializer methods
# sudo gem install bson
# sudo gem install bson_ext
# sudo gem install yajl-ruby
# sudo gem install json
# sudo gem install msgpack
require 'rubygems'
require 'benchmark'
require 'yaml'
require 'bson'
class IssuesController < ApplicationController
default_search_scope :issues
before_filter :find_issue, :only => [:show, :edit, :update]
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
before_filter :find_project, :only => [:new, :create, :update_form]
before_filter :authorize, :except => [:index]
before_filter :find_optional_project, :only => [:index]
before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form]
@paneq
paneq / gist:3103603
Created July 13, 2012 08:19 — forked from paulirish/gist:3098860
Open Conference Expectations

Open Conference Expectations

For conferences, it's extremely important that attendees get top-quality content from industry experts. As a highly compelling format of educating others based on experience and research, conferences stand to be one the best sources of refined knowledge available. Still, it's important for a successful event to have a few guidelines to ensure quality content from the best and most appropriate speakers. Below is a set of guidelines for conference organizers that ensure quality content for attendees and the community.

What We, As Speakers, Expect from Conferences

  1. Video recordings: Organizers should prioritize recording all talks and sessions. A conference that only teaches the ~300 people in the room has constrained value and is not worthwhile to a speaker who wants to benefit the community. When recorded, video will be available online under a permissive license (CC-BY-*) within six months of the event.

  2. Travel reimbursement: Conferences will reimburse travel

@paneq
paneq / maybe.rb
Created March 28, 2012 13:17 — forked from pzol/maybe.rb
Maybe in ruby
def Maybe(obj)
Maybe.new(obj)
end
class Nothing
include Singleton
end
class Maybe
attr_reader :value
@paneq
paneq / me_gusta.rb
Created February 26, 2012 10:27 — forked from LTe/me_gusta.rb
Challenge
class TestUser
def is_ok?
true
end
def receive_message
yield("message", self)
end
def &(other)