This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==== Error | |
ActiveRecord::StatementInvalid (PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list | |
LINE 1: ...comments ON comments.post_id = posts.id ORDER BY comments.c... | |
^ | |
: SELECT distinct posts.* FROM "posts" INNER JOIN comments ON comments.post_id = posts.id ORDER BY comments.created_at DESC LIMIT 5): | |
app/models/comment_activity.rb:18:in `find_recent' | |
app/controllers/admin/dashboard_controller.rb:4:in `show' | |
===== Controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
# [...] | |
named_scope :order_by , lambda { |order| { :order => (order) } } | |
named_scope :limit , lambda { |*lim| { :limit => (lim.first || DEFAULT_LIMIT) } } | |
named_scope :published_before, lambda { |*time| | |
{:conditions => [ "published_at < ?", (time.first || Time.now) ]}} | |
named_scope :with_comments, {:include=>:comments} | |
named_scope :remove_duplications, :select => 'distinct posts.*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error | |
ActiveRecord::StatementInvalid in Admin/dashboardController#show | |
PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list | |
LINE 1: ...comments ON comments.post_id = posts.id ORDER BY comments.c... | |
^ | |
: SELECT distinct posts.* FROM "posts" INNER JOIN comments ON comments.post_id = posts.id ORDER BY comments.created_at DESC LIMIT 5 | |
Application Trace | Framework Trace | Full Trace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class AllYourBase | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
end | |
def call(env) | |
@request = Rack::Request.new(env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "dm-core" | |
class Word | |
include DataMapper::Resource | |
property :id, Serial | |
property :text, String | |
has n, :translations #, :model => 'Word', :foreign_key => [:word_id] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: List the most popular gists of the moment # features/home_page.feature:5 | |
Given I am on the homepage # features/step_definitions/web_steps.rb:18 | |
And an awesome gist exists # features/step_definitions/base_steps.rb:1 | |
Then I should see "This gist is awesome" # features/step_definitions/web_steps.rb:99 | |
undefined method `assert' for #<Object:0x..fdb40ebbe> (NoMethodError) | |
./features/step_definitions/web_steps.rb:104 | |
./features/step_definitions/web_steps.rb:13:in `with_scope' | |
./features/step_definitions/web_steps.rb:100:in `/^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/' | |
features/home_page.feature:8:in `Then I should see "This gist is awesome"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'load-path "~/.emacs.d/erc") | |
(require 'erc) | |
;; Only track my nick(s) | |
(defadvice erc-track-find-face (around erc-track-find-face-promote-query activate) | |
(if (erc-query-buffer-p) | |
(setq ad-return-value (intern "erc-current-nick-face")) | |
ad-do-it)) | |
(setq erc-keywords '("Lau" "lau" "ljensen")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; xercise 1 - Cellular Automaton - Cellular automata are fun and fairly easy to implement. | |
;; In this exercise you will build Conway's Game of Life in Clojure with a Swing GUI. | |
;; Kudos For Oregu (author). | |
(ns life | |
(:import (javax.swing JFrame JPanel JButton JTextArea JLabel SwingUtilities JScrollPane WindowConstants) | |
(java.awt Graphics BorderLayout FlowLayout Color Dimension) | |
(java.awt.event MouseListener ActionListener MouseEvent MouseAdapter)) | |
(:use [clojure.contrib.seq-utils :only (flatten)])) |
OlderNewer