This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'sinatra' | |
group :test do | |
gem "rspec" | |
gem "rack-test" | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'auto increment' do | |
let!(:prev_widget) { FactoryGirl.create(:widget) } | |
let!(:new_widget) { FactoryGirl.create(:widget) } | |
subject { new_widget.sequence_no } | |
it { should be_incremented_by_one(prev_widget.sequence_no) } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var trait:LoadTrait = pMediaPlayer.videoDisplay.mx_internal::videoPlayer. | |
media.getTrait(MediaTraitType.LOAD) as LoadTrait; | |
if (trait.__loader is RTMPDynamicStreamingNetLoader) { | |
var rtmpLoader:RTMPDynamicStreamingNetLoader = | |
trait.__loader as RTMPDynamicStreamingNetLoader; | |
if (rtmpLoader.__ns != null) { | |
mSensors.track(rtmpLoader.__ns, { | |
"stream": "livestreams/" + mCaption, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SpringAnalyticsJS = { | |
sensors: new SpringStreams("dbstream") | |
, screenX: 0 | |
, screenY: 0 | |
, duration: 0 | |
, position: 0 | |
, streamName: null | |
, uid: "test" + (new Date().getTime() * 10000 * Math.random()) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.easystream | |
{ | |
import flash.display.DisplayObject; | |
import flash.events.NetDataEvent; | |
import flash.events.VideoEvent; | |
import flash.external.ExternalInterface; | |
import flash.net.NetStream; | |
import mx.controls.Alert; | |
import mx.core.mx_internal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spork' | |
#uncomment the following line to use spork with the debugger | |
#require 'spork/ext/ruby-debug' | |
Spork.prefork do | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
include FlexiModel | |
flexi_field :name, :string | |
flexi_field :price, :decimal | |
set_flexi_partition_id USER.store.id | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put it on your model instance | |
def column_for_attribute(name) | |
# Put your accessor name, in my case :value | |
if :value == name.to_sym | |
self.class.columns_hash[self.field.value_column.to_s] | |
else | |
self.class.columns_hash[name.to_s] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page < ActiveRecord::Base | |
attr_accessible :body, :metadata, :title, :store_id | |
# Relationships | |
belongs_to :store | |
# Validations | |
validates_presence_of :title, :body, :store_id | |
# Scopes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say_hi_to(&block) | |
puts "Say hi #{block.call}" | |
end | |
say_hi_to { "hasan" } | |
#=> Say hi hasan |