Skip to content

Instantly share code, notes, and snippets.

View gmrdad82's full-sized avatar
🎮
Gaming

Catalin Ilinca gmrdad82

🎮
Gaming
  • Castellon de la Plana, Spain
  • 09:28 (UTC +02:00)
  • YouTube @GmrDad82
View GitHub Profile
@gmrdad82
gmrdad82 / gist:7cc38793e45af0d2178f
Last active September 8, 2015 19:23 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@gmrdad82
gmrdad82 / delegate_matcher.rb
Last active August 29, 2015 14:26 — forked from txus/delegate_matcher.rb
RSpec matcher for delegations
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:month).to(:created_at) }
# it { should delegate(:year).to(:created_at) }
# end
Name : Sam
Serial : eJzzzU/OLi0odswsqglOzK0xsjQzNzI2NjA1q3GuMQQAnJAJjw==
@gmrdad82
gmrdad82 / preferences.json
Created April 13, 2015 10:00
Sublime Text 3 Preferences
{
"always_show_minimap_viewport": true,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
@gmrdad82
gmrdad82 / packages.json
Last active August 29, 2015 14:19
Sublime Text 3 Packages
{
"in_process_packages":
[
],
"installed_packages":
[
"AlignTab",
"Better CoffeeScript",
"BlameHighlighter",
"BracketHighlighter",
@gmrdad82
gmrdad82 / install.sh
Last active August 29, 2015 14:15 — forked from icem/install.sh
chmod +x git-hooks/pending_migrations_check.rb
cd .git/hooks
ln -is ../../git-hooks/pending_migrations_check.rb post-merge
ln -is ../../git-hooks/pending_migrations_check.rb post-checkout
@gmrdad82
gmrdad82 / gist:9f833b8190a8d6506c70
Last active August 29, 2015 14:14 — forked from dhh/gist:2492118
Split Rails routes
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@gmrdad82
gmrdad82 / README.md
Last active August 29, 2015 14:13 — forked from peterdietz/README.md

Most instructions for using Capistrano tell you how to make it restart Phusion Passenger by 'touch'ing the restart.txt file, but this doesn't immediately restart the app - instead the first person to try to use the application will cause it to be restarted, so they will see a delay of at least a few seconds.

This shows how to add a post-deploy task to 'ping' the server, to cause it to restart immediately.

Then add a deploy:ping task to config/deploy.rb and set it to run automatically after deploy:restart. Alternatively you could put it into the deploy:restart task directly.

TODO: Test the response HTTP header of the ping, that it is a 200, and not some other error response (404/500).

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
/**
* @example
* <span ng-html='foo.bar'></span>
*/
app.directive('ngHtml', function() {
return function(scope, element, attrs) {
scope.$watch(attrs.ngHtml, function(value) {
element[0].innerHTML = value;
});
}