Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
Factory.define :user do |user|
user.email { Forgery::Internet.email_address }
end
> Factory.create(:user)
=> #<User id: 1, email: "[email protected]">
> Factory.create(:user)
=> #<User id: 2, email: "[email protected]">
Factory.define :user do |user|
f.sequence(:email) { |n| "user#{n}@example.com" }
end
> Factory.create(:user)
=> #<User id: 1, email: "[email protected]">
> Factory.create(:user)
=> #<User id: 2, email: "[email protected]">
--type-add=ruby=.haml,.slim,.rake,.rsel,.builder,.prawn
--type-add=html=.html.erb,.html.haml,.html.slim
--type-add=js=.js,.js.erb
--type-add=css=.sass,.scss
--type-set=cucumber=.feature
--type-set=ejs=.ejs
--type-set=markdown=.markdown
--ignore-dir=log
--ignore-dir=rails
--ignore-dir=sencha-touch-1.1.0
class FalseClass
def affirmative?
false
end
end
class NilClass
def affirmative?
false
end
## BEFORE
def listing_fee
fee = 0
if self.seller.commercial?
fee += 400 # $4.00 listing fee
elsif self.seller.partner?
fee += 500 # $5.00 listing fee
else # seller is private seller
@search = Sunspot.search(KarastanCarpet) do |search|
search.keywords(params[:keywords]) if params[:keywords].present?
search.with(:effective_brand, KarastanCarpet.brand_for_dealer(@dealer))
search.with(:color_category_names).any_of(
params[:color_category_names] ) if params[:color_category_names].present?
search.with(:fiber_name).any_of(
params[:fiber_names] ) if params[:fiber_names].present?
## WORKING QUERY ##
INFO: [] webapp=/solr path=/select params={facet=true&sort=color_category_names_count_i+desc&start=0&f.fiber_name_ss.facet.mincount=1&q=*:*&f.color_category_names_sm.facet.mincount=1&facet.field=color_category_names_sm&facet.field=style_names_sm&facet.field=fiber_name_ss&f.style_names_sm.facet.mincount=1&wt=ruby&fq=type:KarastanCarpet&fq=effective_brand_s:Karastan&fq=-id_i:(0+OR+1899+OR+1948+OR+1981+OR+1986+OR+1958+OR+1949+OR+1900+OR+1901+OR+1902+OR+1903+OR+2040+OR+1971+OR+1904+OR+1905+OR+1963+OR+1906+OR+1907+OR+1908+OR+2003+OR+1969+OR+1909+OR+1951+OR+1910+OR+1911+OR+1912+OR+1913+OR+1955+OR+1965+OR+1914+OR+1915+OR+1952+OR+1957+OR+1916+OR+1917+OR+1918+OR+1966+OR+1925+OR+1926+OR+1961+OR+1972+OR+1928+OR+1929+OR+1973+OR+1930+OR+1931+OR+1960+OR+1932+OR+1934+OR+1935+OR+1974+OR+1953+OR+1936+OR+1937+OR+2023+OR+1938+OR+1967+OR+1975+OR+1976+OR+1978+OR+1980+OR+1939+OR+1940+OR+1941+OR+1979+OR+1942+OR+1943+OR+1962+OR+1954+OR+1944+OR+1945+OR+1946+OR+1959+OR+1947)&rows=10} hits=173 status=0 QTime=112
S
git question
i want to show the current revision of a file
and the previous revision of a file
git show HEAD~6:db/catalog_items/karastan_carpets.tsv
git show HEAD~7:db/catalog_items/karastan_carpets.tsv
at the moment these two commands give me what I want
but as commits are made the 6 and 7 will change
what is the git treeish syntax for "current revision" and "previous revision"?
does such a thing even exist?
--type-add=ruby=.haml,.slim,.rake,.rsel,.builder,.prawn
--type-add=html=.html.erb,.html.haml,.html.slim
--type-add=js=.js,.js.erb
--type-add=css=.sass,.scss
--type-set=cucumber=.feature
--type-set=ejs=.ejs
--type-set=markdown=.markdown
--ignore-dir=log
--ignore-dir=rails
--ignore-dir=tmp
def update_monitoring_state_for_paths(checked_paths, unchecked_paths) #ckdake
change_found = false
flatten_paths do |child, flattened_path|
if checked_paths.include?(flattened_path) && child.unmonitored?
puts "im not monitored and i should be!"
child.start_monitoring
change_found = true
end