Skip to content

Instantly share code, notes, and snippets.

@denishaskin
denishaskin / AngularJS-+-Google-Maps-API.markdown
Created February 4, 2015 01:08
AngularJS + Google Maps API
@denishaskin
denishaskin / agencies_controller.rb
Created October 1, 2014 23:27
ordering fields_for
def edit
@agency = Agency.find(params[:id])
# add comments for locales that don't have comments yet, so we can present fields to the user
(I18n.available_locales.map(&:to_s) - @agency.comments.pluck(:locale)).each do |loc|
@agency.comments.build locale: loc
end
end
def create_itineraries
threads = []
trip_parts.each do |trip_part|
threads << Thread.new do
begin
trip_part.create_itineraries
ensure
begin
if (ActiveRecord::Base.connection && ActiveRecord::Base.connection.active?)
ActiveRecord::Base.connection.close
@denishaskin
denishaskin / git-workflow.sh
Created August 26, 2013 20:10
git workflow notes
git checkout develop # all developer work is off of this branch
git pull --rebase # make sure local develop is up-to-date (can this be git rebase?)
git checkout -b my-nifty-feature-559876 # create your feature branch; I like to put Pivotal story ID in it for convenience; not required
# do your work, make sure all tests still pass, etc. COMMIT FREQUENTLY
git commit -m "First part of my nifty feature working; now on to the back-end."
# After every commit, rebase from develop. Will show conflicts early. Keep your local branches up-to-date with remote.
git pull --rebase # can this be git rebase?
# repeat above 2 frequently as you're working
# when you're done, pull and rebase one last time, make sure tests pass, then final commit with Pivotal comment
git commit -m "It works! [Fixes #559876]" # commit when done. Include comment like that for Pivotal integration
@denishaskin
denishaskin / 1375888757_autoreconf.log
Last active December 20, 2015 18:19
errors when trying to install ruby, rvm on osx
[2013-08-07 11:19:17] autoreconf
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:427: warning: underquoted definition of RUBY_TRY_CFLAGS
configure.in:427: run info Automake 'Extending aclocal'
configure.in:427: or see http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
autom4te: need GNU m4 1.4 or later: /usr/bin/m4
aclocal: error: echo failed with exit status: 1
autoreconf: aclocal failed with exit status: 1
development:
adapter: postgresql
encoding: unicode
database: oneclick_development
pool: 5
username: oneclick_development
password:
template: template0
# Connect on a TCP socket. Omitted by default since the client uses a
@denishaskin
denishaskin / new.html.haml
Created July 3, 2013 19:01
how best to make associations in controller?
= simple_form_for(@trip) do |f|
= f.input :from_place, :collection => @trip.owner.places
= f.input :to_place, :collection => @trip.owner.places
-# ...etc...

Living room:

Living room

Looking from living room into dining room, with kitchen beyond.

Looking from living room into dining room, with kitchen beyond.

Living room toward front hallway.

@denishaskin
denishaskin / gist:5707260
Created June 4, 2013 16:16
Note from #heroku
justincampbell
12:13 denishaskin: it helps a lot to enable https://devcenter.heroku.com/articles/log-runtime-metrics and watch your dyno usage here https://log2viz.herokuapp.com
@denishaskin
denishaskin / chef-error-highline.log
Created July 12, 2012 20:49
Gem::LoadError: Could not find highline (>= 1.6.9)
$ sudo cat /var/chef/cache/chef-stacktrace.out
Generated at 2012-07-12 20:13:19 +0000
Gem::LoadError: Could not find highline (>= 1.6.9) amongst [builder-3.0.0, bundler-1.1.4, excon-0.14.3, fog-1.4.0, formatador-0.2.3, json-1.7.3, mime-types-1.19, multi_json-1.3.6, net-scp-1.0.4, net-ssh-2.5.2, nokogiri-1.5.5, rake-0.9.2.2, ruby-hmac-0.4.0]
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs'
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `block in find_in_unresolved'
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `map'
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `find_in_unresolved'
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:43:in `require'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/checksum_cache.rb:46:in `reset!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/checksum_cache.rb:38:in `initialize'