Skip to content

Instantly share code, notes, and snippets.

View ximus's full-sized avatar

Maxime Liron ximus

View GitHub Profile
resources :projects do
member do
get :new_sub_project
end
end
match "projects/:id" => "projects#create_sub_project",
:conditions => { :method => :post },
:as => :create_sub_project
require "rubygems"
require "java"
require "mdbdriver.jar"
require "log4j.jar"
require "commons_logging.jar"
require "commons_lang.jar"
Java::jstels.jdbc.mdb.MDBDriver
p 1.to_java(:int)
mouseEntered: function(e) {
// console.log(e);
console.log("ENTER_____"+this.get('layerId')) ;
this.setIfChanged('informativeState', YES);
var parent = this.get('parentView');
var index = parent.contentIndexForLayerId(this.get('layerId'));
console.log("Adding index of "+this.get('layerId'));
@ximus
ximus / mouseEnter listItem
Created December 31, 2010 02:22
debugging
mouseEntered: function(e) {
// console.log(e);
console.log("ENTER_____"+this.get('layerId')) ;
this.setIfChanged('informativeState', YES);
var parent = this.get('parentView');
var index = parent.contentIndexForLayerId(this.get('layerId'));
console.log("Adding index of "+this.get('layerId'));
@ximus
ximus / gist:824397
Created February 13, 2011 03:15
/var/log/syslog
We couldn’t find that file to show.
config :all,
:required => [:sproutcore, 'sproutcore/statechart', :scui],
:themes => ['sproutcore/ace', 'scui/standard_theme']
Scenario: Schedule a send time which is *future* to the deal's end date
Given the following deal exists:
| slug | status | end_at |
| deal789 | in-flight | Time.now.tomorrow.midnight - 2.hours |
When I send a POST request to /api/v1/targeted_emails with the following:
"""
{
"api_key" : "homerun",
"deal_id" : 123,
"user_ids" : [user123],
(::) failed steps (::)
expected between?(Tue, 15 May 2012 23:43:36 UTC +00:00, Tue, 15 May 2012 23:47:36 UTC +00:00) to return true, got false (RSpec::Expectations::ExpectationNotMetError) (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/deal_edit_attachment.rb:20
./features/step_definitions/deal_edit_attachment.rb:10:in `/^see a new row corresponding to the uploaded attachment$/'
features/admin2/deal_edit_attachment.feature:16:in `And see a new row corresponding to the uploaded attachment'
Failing Scenarios:
cucumber -p cruise features/admin2/deal_edit_attachment.feature:14 # Scenario: Upload attachments
@ximus
ximus / kcompl.rb
Created September 23, 2012 23:43
Testing max's reasoning
# I'm assuming sum operations are cheap and I won't gain much, if at all, from
# memoizing sums.
def complementary_pairs(k, a)
matches = 0
a.each_index do |i|
# sum the tail, the elements from i (excluded) to the end of a
(i...a.length).each do |j|
sum = a[i] + a[j]
# we have a match but, ...
if sum == k
def complementary_pairs(k, a)
matches = 0
a.each_index do |i|
# sum the tail, the elements from i (excluded) to the end of a
(i...a.length).each do |j|
sum = a[i] + a[j]
# we have a match but, ...
if sum == k
# if its the sum of itself, then there can only be one match
if i == j