Skip to content

Instantly share code, notes, and snippets.

View leifcr's full-sized avatar

Leif Ringstad leifcr

View GitHub Profile
@leifcr
leifcr / InkscapeBatchConvert.bat
Last active November 29, 2019 21:40 — forked from Elrinth/InkscapeBatchConvert.bat
Batch converter for windows using inkscape and the command line
@Echo off
set "inkscapePath=C:\Program Files\Inkscape\inkscape.exe"
set /a count=0
set validInput1=svg
set validInput2=emf
set validInput3=wmf
set validOutput1=eps
set validOutput2=pdf
set validOutput3=png
@leifcr
leifcr / raven-config.html
Created April 5, 2016 17:55 — forked from impressiver/raven-config.html
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@leifcr
leifcr / config.json
Last active August 29, 2015 14:15 — forked from anonymous/config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@leifcr
leifcr / gist:9462906
Last active August 29, 2015 13:57 — forked from pahanix/gist:885671
# config/initializers/clear_dev_logs.rb
# This snippet simply clears your logs when they are too large.
# Large logs for development are usually something you don't want.
# Every time you run rails server or rails console it checks the size
# of your development logfile and truncates it.
if Rails.env.development?
MAX_LOG_SIZE = 1.megabytes
DEV_LOG_FILE = File.join(Rails.root, 'log', 'development.log')
@leifcr
leifcr / gist:6448361
Last active June 20, 2017 15:45 — forked from grigio/gist:6138263
Install PhantomJS 1.9.1 x64 on ubuntu 12.04
sudo apt-get install libfontconfig1
cd /usr/local/share/
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
tar xjf phantomjs-1.9.1-linux-x86_64.tar.bz2
rm -f phantomjs-1.9.1-linux-x86_64.tar.bz2
ln -s phantomjs-1.9.1-linux-x86_64 phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs
phantomjs --version
require 'resque_mailer'
require 'devise/async'
# pop and set locale from the args before running
module PerformWithLocale
def perform(*args)
I18n.with_locale(args.pop) do
super(*args)
end
end
@leifcr
leifcr / .irbrc
Last active December 13, 2015 16:58 — forked from patmcnally/.irbrc
irbrc with wirble, hirb and awesome_print + logging of activesupport requests...
# load libraries
require 'rubygems' rescue nil
alias q exit
class Object
def local_methods
(methods - Object.instance_methods).sort
end
end
@leifcr
leifcr / quiet_assets.rb
Created December 11, 2012 18:07
Rails 3.2 compatible quiet assets
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
end
end
# mongo_template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
@leifcr
leifcr / will_paginate.rb
Created October 21, 2011 21:35 — forked from henrik/will_paginate.rb
Extends will_paginate to play well with Twitter's Bootstrap (http://twitter.github.com/bootstrap/). Suggested location: config/initializers/will_paginate.rb
# https://gist.github.com/1305042
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer