This file contains 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
module Spree | |
Spree::Product.class_eval do | |
def self.getprods(params) | |
#get taxon_id from permalink | |
taxonid = params[:id].blank? ? nil : Taxon.find_by_permalink!(params[:id]).id | |
#keywords for paging | |
keywords = params[:keywords] | |
per_page = params[:per_page].to_i | |
per_page = per_page > 0 ? per_page : Spree::Config[:products_per_page] |
This file contains 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
# /etc/nginx/sites-available/default | |
upstream my_site { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/my_site.socket fail_timeout=0; | |
} |
This file contains 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 Spree::RewardsRegistrationController < ApplicationController | |
def index | |
if !current_user | |
redirect_to spree.login_path | |
else | |
#render :text => "TEST ID" | |
user = Spree::User.find(Spree::User.current.id) | |
user.rewards ? @filled = true : @filled = false | |
end |
This file contains 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 Spree::Admin::AmazonProduct < ActiveRecord::Base | |
attr_accessible :Description, :FileName, :Title, :template | |
@queue = :amazon_products | |
def self.perform(id,filename,site) | |
puts "#{Time.now}" | |
start_time = Time.now | |
puts "loading products..." |
This file contains 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
module Spree | |
Spree::Taxon.class_eval do | |
include ::Spree::ProductFilters # for detailed defs of filters | |
def get_attributes(taxon) | |
This file contains 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
SELECT DISTINCT `spree_products`.* FROM `spree_products` INNER JOIN `spree_variants` ON | |
`spree_variants`.`product_id` = `spree_products`.`id` AND `spree_variants`.deleted_at IS NULL AND | |
`spree_variants`.is_master = 1 INNER JOIN `spree_products_taxons` ON | |
`spree_products_taxons`.`product_id` = `spree_products`.`id` INNER JOIN `spree_taxons` ON | |
`spree_taxons`.`id` = `spree_products_taxons`.`taxon_id` INNER JOIN `spree_product_properties` ON | |
`spree_product_properties`.`product_id` = `spree_products`.`id` WHERE `spree_products`.`deleted_at` IS | |
NULL AND `spree_taxons`.`id` IN (307170557) AND (available_on <= '2012-09-15 08:27:25') AND ( | |
spree_variants.price >= 500.00 AND spree_products.id IN (SELECT spree_product_properties.product_id | |
FROM spree_product_properties where spree_product_properties.property_id = 33113319 AND | |
spree_product_properties.value = 'Acer' OR spree_product_properties.value = 'HP' ) AND |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace BrightSolid | |
{ | |
class Program | |
{ |
This file contains 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
public static bool IsAnagram(string WordA, string WordB) | |
{ | |
return WordA.OrderBy(x => x).SequenceEqual(WordB.OrderBy(x => x)); | |
} |
This file contains 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
4a. select * from employee where age > 40; | |
4b. select top 1 * from employee order by age desc; | |
4c .select top 1 lastname,count(*) as count from employee group by lastname order by count desc; | |
4d. select lastname,count(*) as count from employee where count > 10 group by lastname HAVING COUNT(lastname) > 10 order by count desc; | |
5. SELECT employee.lastname +', '+employee.forename as 'employee_name' ,department.deptdesc AS 'department' | |
FROM department INNER JOIN |
This file contains 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
using System; | |
using System.Collections.Generic; | |
public delegate void FoundString(string found); | |
public class WhatDoIDo | |
{ | |
private ILogger _logger = new Logger(); | |
private readonly List<object> _objects = new List<object>(); | |
public event FoundString Found; |
OlderNewer