Skip to content

Instantly share code, notes, and snippets.

Laurent Prévost Prevole

Block or report user

Report or block Prevole

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Prevole
Prevole / main.js
Created Aug 23, 2012
Sort of data grid with Backbone + Marionette (with a rails backend)
View main.js
// 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 Aug 21, 2012
Rails plugin with only assets
View backbone-bundle.gemspec
$:.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"]
View admin_controller.rb
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 Mar 28, 2012
Yard documentation
View somefile.rb
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 Mar 9, 2012
Rails + Rspec + Capybara + Selenium
View gemfile
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 Nov 14, 2011
Shoulda-Matchers + RSpec
View mymodel_factory.rb
require ".../mymodel"
FactoryGirl.define do
factory :mymodel, :class => MyModel do |m|
end
end
View Structure.txt
/lib
/generators
/Amazing
/install
/install_generator.rb
/templates
/create_settings.rb
View Gruntfile.js
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
probedockSetup: {
all: {}
},
probedockPublish: {
all: {}
You can’t perform that action at this time.