Skip to content

Instantly share code, notes, and snippets.

# app/models/my_model.rb
module MyApp
module Model
def self.included(base)
base.send :include, Mongoid::Document
base.send :include, Mongoid::Timestamps
base.send :include, ActiveAdmin::Mongoid::Patches
end
end
# your-engine/lib/magic/rails/engine.rb
module Magic
module Rails
module Engine
##
# Automatically append all of the current engine's routes to the main
# application's route set. This needs to be done for ALL functional tests that
# use engine routes, since the mounted routes don't work during tests.
#
@import "active_admin/mixins"
@import "active_admin/components/links"
body
@include global-reset
@import "active_admin/typography"
@import "active_admin/header"
@import "active_admin/forms"
@import "active_admin/components/comments"
@import "active_admin/components/flash_messages"
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
# Russian. Updated 2012-07-18
ru:
admin:
home:
name: "Главная"
pagination:
previous: "« Предыдущая"
next: "Следующая »"
truncate: "…"
@danil-z
danil-z / style.scss
Created August 22, 2013 19:20 — forked from daz/style.scss
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@danil-z
danil-z / brew.rb
Last active August 29, 2015 14:26 — forked from royingantaginting/brew.rb
Brew formula to install oclint version 0.8.1 or 0.9.dev.02251e4
require 'formula'
class Oclint < Formula
homepage 'http://oclint.org'
url 'http://archives.oclint.org/releases/0.8/oclint-0.8.1-x86_64-darwin-14.0.0.tar.gz'
version '0.8.1'
sha1 'c96d712c5b73e04eebb57c3a97dec2b4ecbb9ed4'
devel do
url 'http://archives.oclint.org/nightly/oclint-0.9.dev.603daa8-x86_64-darwin-14.4.0.tar.gz'
@danil-z
danil-z / oclint.rb
Last active November 6, 2015 11:44 — forked from TonyAnhTran/oclint.rb
require 'formula'
class Oclint < Formula
homepage 'http://oclint.org'
url 'http://archives.oclint.org/nightly/oclint-0.9.dev.603daa8-x86_64-darwin-14.4.0.tar.gz'
version '0.9.dev.603daa8'
sha1 '9ee49d2fd167eec09e1a33a56081c1bb22721f0d'
def install
lib.install Dir['lib/clang']
@danil-z
danil-z / oclint-json-compilation-database-parallel
Last active August 29, 2015 14:26 — forked from tommeier/oclint-json-compilation-database-parallel
oclint-json-compilation-database with parallel execution
#!/usr/bin/env python
# Test run with parallel
import os
import platform
import json
import argparse
import re
import subprocess
import sys