Skip to content

Instantly share code, notes, and snippets.

View justincaldwell's full-sized avatar

Justin Caldwell justincaldwell

View GitHub Profile
@justincaldwell
justincaldwell / default.rb
Created June 25, 2013 18:59
libharu chef recipe cookbook: libharu
package 'build-essential'
package 'libpng-dev'
package 'libtool'
package 'automake'
tar_file = "libharu.tar.gz"
remote_file "/opt/#{tar_file}" do
source "https://github.com/libharu/libharu/tarball/master/#{tar_file}"
end
[ 2013-05-22 16:22:04.5860 768/7fa2c5132700 Pool2/Implementation.cpp:1156 ]: [App 10278 stderr] [ 2013-05-22 16:22:04.5858 10338/0x00000004166ee0(Worker 1) utils.rb:71 ]: *** Exception ThreadError in Rack application object (deadlock; recursive locking) (process 10338, thread 0x00000004166ee0(Worker 1)):
[ 2013-05-22 16:22:04.5860 768/7fa2c5132700 Pool2/Implementation.cpp:1156 ]: [App 10278 stderr] from /home/uber/current/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:in `lock'
[ 2013-05-22 16:22:04.5860 768/7fa2c5132700 Pool2/Implementation.cpp:1156 ]: [App 10278 stderr] from /home/uber/current/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:in `call'
[ 2013-05-22 16:22:04.5861 768/7fa2c5132700 Pool2/Implementation.cpp:1156 ]: [App 10278 stderr] from /home/uber/current/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
[ 2013-05-22 16:22:04.5861 768/7fa2c5132700 Pool2/Implementation.cpp:1156 ]: [App 10278 st
2013-03-19 15:46:11 [INFO] [Faye::Server] Processing messages: [{"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["callback-polling"],"id":"1"}] (local: false)
2013-03-19 15:46:11 [DEBUG] [Faye::Server] Passing through incoming extensions: {"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["callback-polling"],"id":"1"}
2013-03-19 15:46:11 [INFO] [Faye::Server] Handling message: {"channel":"/meta/handshake","version":"1.0","supportedConnectionTypes":["callback-polling"],"id":"1"} (local: false)
### Before
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 1115 | 854 | 22 | 94 | 4 | 7 |
| Helpers | 26 | 17 | 0 | 2 | 0 | 6 |
| Models | 2390 | 1494 | 49 | 142 | 2 | 8 |
| Libraries | 396 | 315 | 5 | 27 | 5 | 9 |
| Integration tests | 0 | 0 | 0 | 0 | 0 | 0 |
INFO: ContextListener: contextDestroyed()
Nov 10, 2012 5:45:27 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet SolrUpdate threw exception
java.lang.NullPointerException
at org.apache.solr.core.SolrCore.close(SolrCore.java:699)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:280)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
@justincaldwell
justincaldwell / gist:3499546
Created August 28, 2012 16:06
Postgres setup
sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 libpq-dev
sudo su postgres
psql
(from psql console)
create user ccpz with password 'ccpz';
create database ccpz OWNER ccpz ENCODING 'UTF8';
ALTER USER ccpz WITH SUPERUSER;
\q
playlist = Playlist.create(name: 'My Playlist', org_id: Org.find_by_slug('vidpresso').id)
# Create a bunch of entries in your dev database by sending a bunch of posts to air
# Now you can move those to the newly created playlist
playlist.entries << Entry.limit(5).order('id desc')
# Make sure Foreman is started (foreman start -f Procfile.development)
# And playback the playlist
@justincaldwell
justincaldwell / pre-commit
Created June 12, 2012 22:11
Pre commit hook to check syntax - Add to ./git/hooks/pre-commit
#!/usr/bin/env ruby
# vim: set syntax=ruby
flag = false
staged_files = `git diff --cached --name-only`.split
ruby_files = staged_files.select{|s| s =~ /\.rb$/}
ruby_files.each do |file|
def yield_with_default(name, content = nil, &block)
if content_for?(name)
content_for(name)
else
block_given? ? capture(&block) : content
end
end
require 'goliath'
require 'em-synchrony'
require 'em-synchrony/em-http'
require 'nokogiri'
class ReactorMulti < Goliath::API
def response(env)