Skip to content

Instantly share code, notes, and snippets.

View rvanlieshout's full-sized avatar

Rene van Lieshout rvanlieshout

View GitHub Profile
def name
raise DeprecationError if user.present?
super
end
@rvanlieshout
rvanlieshout / rubocop.yml
Last active November 12, 2015 12:56
Bluerail Rubocop configuration
Metrics/LineLength:
Max: 120
@rvanlieshout
rvanlieshout / console output
Created October 22, 2015 08:50
uninitialized constant draper
[1] pry(main)> VoucherDecorator
=> VoucherDecorator
[2] pry(main)> VoucherDecorator.new
ArgumentError: wrong number of arguments (0 for 1..2)
from /usr/local/rvm/gems/ruby-2.2.1/gems/draper-2.1.0/lib/draper/decorator.rb:30:in `initialize'
-bash-4.1$ identify -verbose Bakje_Mie.psd
Image: Bakje_Mie.psd
Format: PSD (Adobe Photoshop bitmap)
Class: DirectClass
Geometry: 2361x2350+0+0
Resolution: 150x150
Print size: 15.74x15.6667
Units: PixelsPerInch
Type: ColorSeparationAlpha
Endianess: Undefined
bar = 1
def foo
bar = 2
end
foo()
puts bar
v() {
vagrant_commands=(box connect destroy global-status halt help init login package plugin provision rdp reload resume share ssh ssh-config status suspend up version)
if [[ ${vagrant_commands[(r)$1]} == $1 ]]
then
vagrant $*
else
vagrant ssh -c "$*"
fi
}
88617:20140901:085700.967 Starting Zabbix Server. Zabbix 2.2.5 (revision 47411).
88617:20140901:085700.967 ****** Enabled features ******
88617:20140901:085700.967 SNMP monitoring: YES
88617:20140901:085700.967 IPMI monitoring: YES
88617:20140901:085700.968 WEB monitoring: YES
88617:20140901:085700.968 VMware monitoring: YES
88617:20140901:085700.968 Jabber notifications: YES
88617:20140901:085700.968 Ez Texting notifications: YES
88617:20140901:085700.968 ODBC: YES
88617:20140901:085700.968 SSH2 support: YES
SELECT row_number FROM (
SELECT row_number() OVER (ORDER BY created_at NULLS LAST) AS row_number, id
FROM posts
WHERE user_id = 123
ORDER BY created_at
) posts
WHERE posts.id = 3
;
@rvanlieshout
rvanlieshout / time_registrations with date, grouped per month.sql
Last active August 29, 2015 14:02
Query to get unique time ranges in MySQL. Next up: see if this can be refactored
mysql> select * from intervals;
+----+----------+----------+
| id | start | end |
+----+----------+----------+
| 1 | 15:30:00 | 16:20:00 |
| 2 | 10:00:00 | 13:00:00 |
| 3 | 15:00:00 | 16:09:00 |
| 4 | 11:00:00 | 14:00:00 |
| 5 | 16:20:00 | 16:30:00 |
| 6 | 09:00:00 | 14:00:00 |
link_to :sort => column, :direction => direction do
[
title,
tag(:span, :class => (direction == "asc" ? "glyphicon glyphicon-chevron-up" : "glyphicon glyphicon-chevron-down"))
].inject(&:+)
end