Skip to content

Instantly share code, notes, and snippets.

setTimeout(function() {
console.log(FOTOMOTO.API.isBasketEmpty()); // -> true
}, 1000);
setTimeout(function() {
console.log(FOTOMOTO.API.isBasketEmpty()); // -> true
}, 2000);
setTimeout(function() {
console.log(FOTOMOTO.API.isBasketEmpty()); // -> false
}, 3000);
setTimeout(function() {
var helloMiddleware = function(name) {
return 'Hello ' + + '!';
};
var hiMiddleware = function(name) {
return 'Hi ' + + '!';
};
var counts = {};
var countMiddleware = function(name) {
@mikebannister
mikebannister / meteor-time-test.html
Created April 27, 2012 22:55
Time seems to be off on meteor.com
<head>
<title>Time Test</title>
</head>
<body>
{{> time_test}}
</body>
<template name="time_test">
<h1>Time Test</h1>
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20120203.tar.gz'
sha1 'b0c78e3f142cc735f0518951c04eab947ca7c95b'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install
class ApplicationController < ActionController::Base
protect_from_forgery
user_stamp Attachment, Post, Capsule
before_filter :authentication_check
before_filter :capsule_member
before_filter :set_user_time_zone
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, :with => :render_error
rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
scope :before_date, lambda { |date|
where("shift_date >= ?").where(:shift_status => nil)
}
module Importable
module Validatable
extend ActiveSupport::Concern
included do
include ActiveModel::Validations
include ActiveModel::Serialization
attr_accessor :attributes
end
namespace :spec do
desc "Run the code examples in spec/acceptance"
RSpec::Core::RakeTask.new(:acceptance => "db:test:prepare") do |t|
t.pattern = "spec/acceptance/**/*_spec.rb"
end
end
scope :search, lambda { |field, value|
return where(field, Product.gender_database_param(value)) if field == :gender
return where(field, Product.status_database_param(value)) if field == :status
where(field, value)
}
Product.search(gender: 'male').search(brand: 'whatever')
@mikebannister
mikebannister / gist:1216893
Created September 14, 2011 15:34
Rails engine w/ Rspec

NOTE!!!!!!!!! Ended up in trouble going down this path. Followed Rails 3 in Action method instead

generate

rails plugin new importable --dummy-path=spec/dummy --full --mountable && cd importable

in .gitignore change references to test/dummy to spec/dummy (rails bug¿)

spec/dummy/db/*.sqlite3

spec/dummy/log/*.log