Skip to content

Instantly share code, notes, and snippets.

View demental's full-sized avatar

Arnaud Sellenet demental

  • enerfip.eu
  • france
View GitHub Profile
class ReviewsController < ApplicationController
def edit
@review = Reviews::Submitter.new(params).model
end
def update
submitter = Reviews::Submitter.new(params)
@review = submitter.model
submitter.on(:success) { |review| redirect_to success_reviews_path }
class EventCanvas::Base
class << self
attr_reader :matrix
def context *context_classes
@context_classes = context_classes
end
def subscribers *subscribers_classes
@context_classes.each do |kls|
<?php
/**
* Table Definition for admintype
*/
class InvalidMatrixException extends Exception
{
}
= t('people.list.on_twitter', :link => link_to("@#{list_item.twitter}", "https://twitter.com/#{list_item.twitter}")).html_safe
@demental
demental / gist:1227592
Created September 19, 2011 20:57
Textmate YAML check syntax command
ruby -ryaml -e 'begin
YAML.load(STDIN.read)
p "Syntax OK"
rescue
print "ERROR: ",$!, "\n"
end
'
@demental
demental / Client.php
Created March 15, 2012 16:39
hooks on linksFormTables
<?php
// office/lib/hooks/Client.php
class Client_hook
{
public static function alterLinkFromTables($links,$do)
{
require_once 'lib/CustomUtils.php';
class Wmit::Event < ActiveRecord::Base
end
@demental
demental / ba_app_first_or_array.rb
Created October 29, 2012 11:04
respond_to? VS kind_of?
def with_respond(object)
object.respond_to?(:first)
end
def with_array(object)
object.kind_of? Array
end
class Aclass
//
using('#searchMessage').expect(binding('query')).toBe('nexus');
// VS
using('#searchMessage').expect(binding('query').toBe('nexus')); // => WRONG, but test skipped
class Foo
METHODE_NAMES = ['problems', 'maintenances', 'journeys']
class << self
def get_var(name, hsh)
ApiRequest.new(params: {account_id: hsh[:email], vin: hsh[:vin]},
url: "vehicles/#{hsh[:vin]}/#{name}", verb: "get").get
end
METHODE_NAMES.each do name