Skip to content

Instantly share code, notes, and snippets.

View Prevole's full-sized avatar

Laurent Prévost Prevole

  • @leshopch
  • Switzerland
View GitHub Profile
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
probedockSetup: {
all: {}
},
probedockPublish: {
all: {}
@Prevole
Prevole / main.js
Created August 23, 2012 05:44
Sort of data grid with Backbone + Marionette (with a rails backend)
// JST and HAML Assets is used for the templating pre-compilation
Backbone.Marionette.Renderer.render = function(template, data) {
if (!JST[template]) {
throw "Template '" + template + "' not found!";
}
return JST[template](data);
};
window.MyApp = new Backbone.Marionette.Application();
@Prevole
Prevole / backbone-bundle.gemspec
Created August 21, 2012 07:35
Rails plugin with only assets
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "backbone-bundle/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "backbone-bundle"
s.version = BackboneBundle::VERSION
s.authors = ["Prevole"]
@Prevole
Prevole / admin_controller.rb
Created June 24, 2012 11:16
Rendering problem
module Admin
class AdminController < ApplicationController
def initialize
@datatable_class = "#{self.class.to_s.gsub("Controller", "Datatable")}".constantize
@model_class = "Object::#{self.class.to_s.gsub("Admin::", "").gsub("Controller", "").singularize}".constantize
@param_path = "#{@model_class.to_s.gsub("::", "_").downcase}"
@model_name = "#{@model_class.to_s.demodulize.downcase}"
end
@Prevole
Prevole / somefile.rb
Created March 28, 2012 18:12
Yard documentation
classe MyClass < ActionView::Helpers::FormBuilder
# Some text
# @param [String|Symbol] name Some text too
# @param [Hash] *args Options
# @option *args [Boolean ]:option_name Option description
%w[text_field password_field].each do |method_name|
define_method(method_name) do |name, *args|
# ... some code there ...
end
end
@Prevole
Prevole / gemfile
Created March 9, 2012 22:09
Rails + Rspec + Capybara + Selenium
group :development, :test do
# RSpec
gem "rspec-rails"
gem "factory_girl_rails"
gem "database_cleaner"
gem "shoulda-matchers", :git => "https://github.com/thoughtbot/shoulda-matchers.git"
gem "capybara"
# Spork
gem "spork-rails"#, "> 0.9.0.rc"
@Prevole
Prevole / mymodel_factory.rb
Created November 14, 2011 06:26
Shoulda-Matchers + RSpec
require ".../mymodel"
FactoryGirl.define do
factory :mymodel, :class => MyModel do |m|
end
end
@Prevole
Prevole / Structure.txt
Created October 10, 2011 06:06
Generator
/lib
/generators
/Amazing
/install
/install_generator.rb
/templates
/create_settings.rb