Skip to content

Instantly share code, notes, and snippets.

View thejspr's full-sized avatar
🏋️

Jesper Kjeldgaard thejspr

🏋️
View GitHub Profile
@thejspr
thejspr / gist:1373459
Created November 17, 2011 15:42
Bullseye API venue
// GET http://api.bullseyehub.com/v3/venues/911bf810-d21b-012e-832d-123142ff4e0c
{
"city": "London",
"name": "Purple Turtle",
"created_at": "2009-11-02T16:23:51+00:00",
"country": "United Kingdom",
"postcode": "NW1 1TN",
"updated_at": "2011-09-05T09:28:29+01:00",
"uuid": "911bf810-d21b-012e-832d-123142ff4e0c",
"lng": "-0.1366516",
@thejspr
thejspr / gist:1373591
Created November 17, 2011 16:23
Bullseyehub API v3 Event
// GET http://api.bullseyehub.com/v3/venues/911bf810-d21b-012e-832d-123142ff4e0c/events
{
"name": "ABSOLUTE FILTH #2",
"artists": "Lazarus blackstar, dopefight, dead existence, tree of sores, slabdragger, toad in the tree, koresh, bastardhammer",
"created_at": "2011-10-06T08:44:25+01:00",
"image_url": "http://s3.amazonaws.com/public.attachments.app.bullseyehub.com/system/events/14109/original/277098_243417172367631_315611_n.jpg?1315343920",
"short_description": "ABSOLUTE FILTH #2 - sludge / hardcore / doom / filth - all dayer",
"updated_at": "2011-10-06T08:44:25+01:00",
"uuid": "f00cbb40-d21c-012e-b5ce-123142ff4e0c",
"time": "2011-11-27T14:00:00+00:00",
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://evently-lister.herokuapp.com/evently-lister.js"></script>
<script>
$('#my-events').eventlyLister({
venue: '1' // for a venues events
promoter: '2' // for a promoters events
width: 3 // width of the widget (defaults to the containing elements' width)
theme: 'light' // select a theme (optional)
})
</script>
@thejspr
thejspr / prag_pub.rb
Created December 5, 2012 20:58
Download all PragPub issues from Pragmatic Programmers
#!/usr/bin/env ruby
# encoding: utf-8
require 'open-uri'
VALID_FORMATS = ['pdf', 'html', 'mobi', 'epub']
format = ARGV[0] || 'pdf'
unless VALID_FORMATS.include?(format)
@thejspr
thejspr / gist:5030366
Created February 25, 2013 15:00
JSON vs. Msgpack benchmark
#!/usr/bin/env ruby
# JRuby
# gem install msgpack-jruby
# MRI
# gem install msgpack
require 'benchmark'
@thejspr
thejspr / gist:5576495
Created May 14, 2013 14:46
Add pivotal tracker story number to git commit messages.
#!/usr/bin/env ruby
# put this in .git/hooks/prepare-commit-msg
message_file = ARGV[0]
message = File.read(message_file)
pivotal_story_number = `git rev-parse --abbrev-ref HEAD | grep --only-matching '[0-9]*$'`.strip
# do not add anything if the branch doesn't have a story number or the message already contains one.
@thejspr
thejspr / gist:5621122
Created May 21, 2013 16:21
Mute a given observer
def mute_observer(excluded_observer)
observers = ActiveRecord::Base.observers
ActiveRecord::Base.observers = observers - [excluded_observer]
yield
ensure
ActiveRecord::Base.observers = orig_observers
end
diff --git c/app/models/photo.rb w/app/models/photo.rb
index 60b3ab3..c6a99fb 100644
--- c/app/models/photo.rb
+++ w/app/models/photo.rb
@@ -51,6 +51,7 @@ class Photo < ActiveRecord::Base
:processors => [:thumbnail, :optimize],
:convert_options => {
:search_v4 => '-quality 70',
+ :banner => '-quality 80 -interlace Plane -strip'
}
// ==UserScript==
// @name Travis--
// @namespace thejspr.com
// @version 0.1
// @description Removes some fuzz from the travis UI and improves it for large builds
// @match https://magnum.travis-ci.com/*
// @copyright 2014+, Jesper Kjeldgaard
// ==/UserScript==
$(document).ready(function(){
@thejspr
thejspr / reloading.diff
Last active August 29, 2015 14:07
admin plugin
diff --git i/config/environment.rb w/config/environment.rb
index 7549e10..b1636d4 100644
--- i/config/environment.rb
+++ w/config/environment.rb
@@ -124,6 +124,7 @@ Rails::Initializer.run do |config|
config.autoload_paths << RAILS_ROOT + '/app/services'
config.plugin_paths << 'services'
+ config.reload_plugins = true if ENV["RAILS_ENV"] == 'development'