Skip to content

Instantly share code, notes, and snippets.

View oowowaee's full-sized avatar

Tally oowowaee

View GitHub Profile
class TodoListsController < ApplicationController
before_action :set_current_user
def index
sort_by = params[:sort] || 'created_at'
sort_order = (params[:asc] == 'false') ? 'ASC' : 'DESC'
# This seems like it might be vulnerable to SQL injection. It might be better to whitelist the sortby column.
@lists = TodoList.where(user_id: User.current_user.id).order("#{sort_by} #{sort_order}")
end

Keybase proof

I hereby claim:

  • I am oowowaee on github.
  • I am oowowaee (https://keybase.io/oowowaee) on keybase.
  • I have a public key ASD6r5VzsDgfmXAo7jMMveg5BZsj3it4SZWH7Fo6_QkKbAo

To claim this, I am signing this object:

político 24
bien 16
entonce 14
bueno 13
ahí 11
problema 9
música 8
pantera 8
gente 8
plata 8
# spec/lib/tasks/notification_rake_spec.rb
require 'spec_helper'
describe 'notifications:weekly' do
include_context "rake"
let(:users){ [double(:user)] }
let(:user_deliveries){ double(:user_deliveries) }
before{ User.stub(:all).and_return( users ) }
@oowowaee
oowowaee / TableVerticalSplitHack.js
Last active November 7, 2016 01:59 — forked from vstefanoxx/TableVerticalSplitHack.js
Script to automatically split wide HTML tables that doesn't fit the width of the PDF page generated by WkHtmlToPdf (or equivalent). From an idea of Florin Stancu <niflostancu@gmail.com> and his script wkhtmltopdf.tablesplit.js, this implementation is quite different because the splitting is done vertically on a excessive wide table, while the or…
/**
* WkHtmlToPdf table vertically-splitting hack
* Script to automatically split wide HTML tables that doesn't fit the width of the PDF page generated
* by WkHtmlToPdf (or equivalent)
*
* The general idea come from Florin Stancu <niflostancu@gmail.com> and his script wkhtmltopdf.tablesplit.js
* The implementation is quite different because the splitting is done vertically on a excessive
* wide table, while the original script was meant to split horizontally an excessive long table
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's