Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jpowers on github.
  • I am bennrock (https://keybase.io/bennrock) on keybase.
  • I have a public key ASC-79MT55t9aS1SP7jw2Rdc39H_IkbYff4cIR-f2bkkeQo

To claim this, I am signing this object:

<?xml version="1.0" encoding="ISO-8859-1"?>
<doi_batch
xmlns="http://www.crossref.org/schema/4.4.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.4.1" xsi:schemaLocation="http://www.crossref.org/schema/4.4.1 http://www.crossref.org/schema/deposit/crossref4.4.1.xsd">
<head>
<doi_batch_id></doi_batch_id>
<timestamp>201810231135</timestamp>
<depositor>
<name>American Economic Association</name>
<email_address>info@socialscienceregistry.org</email_address>
Traceback (most recent call last):
File "/srv/ICLEI/lib/python2.7/site-packages/tg/wsgiapp.py", line 105, in __call__
response = self.wrapped_dispatch(controller, environ, context)
File "/srv/ICLEI/lib/python2.7/site-packages/tg/wsgiapp.py", line 278, in dispatch
return controller(environ, context)
File "/srv/ICLEI/freyja/freyja/lib/base.py", line 30, in __call__
return TGController.__call__(self, environ, context)
File "/srv/ICLEI/lib/python2.7/site-packages/tg/controllers/dispatcher.py", line 132, in __call__
response = self._perform_call(context)
File "/srv/ICLEI/lib/python2.7/site-packages/tg/controllers/dispatcher.py", line 113, in _perform_call
“For a beginning, there must be an end. You can wander off your path or you can leave it with purpose. The results may be no different, but forceful actions leave a sparkling trail.”
So thought the Fieldmouse as he set out and strayed into another world.
Pretty Things Beer & Ale Project is drawing to a close.
Seven years ago we sold our first glass of beer at The Publick House in Brookline. We didn’t foresee then that our strange project would become such a part of our lives.
It has been a crazy fun time. We’ve dressed up in more costumes than a Bob Hope special. Amazing employees and friends have conspired with us along the way. Bocky, Anya, and John Funke have channeled our project almost better than we have done ourselves. And we found a rag tag group of like-minded creative brewers out there in the world as well.
@jpowers
jpowers / visual-designer
Created July 10, 2014 14:44
Visual Designer Job Post
Visual Designer (UI/UX)
=======================
Vermonster is a product consulting firm focusing on web applications, located
downtown Boston, Massachusetts. We thrive on learning about our customers,
their industry, the challenges they have. We collectively figure out how to
pragmatically use software and web applications to solve their problems. We
have built a reputation over the last 12+ years of having a team with solid
development capabilities and a record launching impactful and successful
products.
#return the total number of user_contents for a profile
def self.include_content_count
select('profiles.*, (select count(*) from user_contents where user_contents.profile_id = profiles.id) as user_content_count')
end
#limit the results by user_contents total for a profile
#also call include_content_count to get the count
def self.has_min_content_count(total=1)
include_content_count
.where('(select count(*) as total from user_contents where user_contents.profile_id = profiles.id) > ?', total)
@jpowers
jpowers / gist:5731878
Last active August 1, 2017 20:29
Ruby Hash with range key
class RangedHash
def initialize(hash)
@ranges = hash
end
def [](key)
@ranges.each do |range, value|
return value if range.include?(key)
end
end
class SettingsController < ApplicationController
set_tab :settings
before_filter :authenticate_user!
def edit
@user = current_user
end
def update
ruby-1.9.2-p180 :026 > pp bing.news('"global warming" or "climate change" not happening').news.results.first
{"Title"=>"Climate change is happening but it's out of man's control",
"Url"=>
"http://www.sun-sentinel.com/news/opinion/fl-readers-view-global-warming-20120110,0,6201898.story",
"Source"=>"Sun Sentinel",
"Snippet"=>
"does not seem to understand that the science concerning humans being primarily responsible is far from settled. The writer states that global warming/climate change has been happening for 30 to 100 years, which understates the time frame by ...",
"Date"=>"2012-01-10T07:53:54Z",
"BreakingNews"=>0}
@jpowers
jpowers / gist:1420039
Created December 1, 2011 21:34
inverse_of for in memory association access
class Shipment < ActiveRecord::Base
has_many :labels
accepts_nested_attributes_for :labels
end
class Label < ActiveRecord::Base
belongs_to :shipment
end
ruby-1.9.2-p180 :001 > s = Shipment.new(:vendor_service_code =>'asdasd', "labels_attributes"=>{"0"=>{"package_weight"=>"1", "insured_value"=>"50"}})