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
@pdf.formatted_text_box variation_description(variations.first), | |
width: 1.625.in, | |
align: :center, | |
size: 6, | |
at: [@pdf.bounds.left, @pdf.bounds.top - 2.6.in] | |
def variation_description(variation) | |
[ | |
{ text: "#{variation.code}\n"}, |
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
# Assets are images that need no resampling, fonts, etc, that | |
# are used for the site. Examples are catalog landing pages, | |
# carousel images, etc. | |
class Asset | |
include Mongoid::Document | |
include Mongoid::Paperclip | |
field :type | |
field :catalog_key | |
field :category |
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 elastic_sftp | |
local_files = Dir.glob(File.join(Rails.root, 'data', 'data', "**/*")).map {|f| f.split("data/data/")[1] } | |
@sftp = Net::SFTP.start('sftp.vfc.com', ENV['VFC_USERNAME'], :password => ENV['VFC_PASSWORD']) do |sftp| | |
sftp.dir.glob(File.join("#{@sftp_directory}", 'Elastic' , 'Data'), "**/*.txt").each do |file| | |
if local_files.include?(file.name.downcase) | |
if Time.at(file.attributes.mtime) > File.mtime(File.join(Rails.root, 'data', 'data', file.name.downcase)) | |
sftp.download!(File.join("#{@sftp_directory}", 'Elastic' , 'Data', file.name), | |
File.join(Rails.root, 'data', 'data', file.name.downcase)) | |
p "#{file.name} is out of date and has been downloaded." |
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
# GOAL: CustomCatalogs, Whiteboards Printed, Orders Created, Orders Submitted BY User PER Month | |
(1..12).each do |num| | |
printed_cc = PrintJob::CustomCatalog.where(:updated_at.gte => num.months.ago.beginning_of_month, :updated_at.lte => (num-1).months.ago.beginning_of_month) | |
printed_orders = PrintJob::Document.where(:updated_at.gte => num.months.ago.beginning_of_month, :updated_at.lte => (num-1).months.ago.beginning_of_month) | |
printed_whiteboards = PrintJob::Whiteboard.where(:updated_at.gte => (num.months.ago).beginning_of_month, :updated_at.lte => (num-1).months.ago.beginning_of_month ) | |
arr = {} | |
printed_cc.each do |cc| | |
next if cc.author.nil? |
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
# Make sure you require rake and then create a new | |
# 'task' called 'test'. Then you can run rake test | |
# and it add libs, test, look for the pattern of _test, | |
# and run. Finally, make test default for rake, so | |
# now you just need to type 'rake' to run it. | |
require 'rake' | |
require 'rake/testtask' | |
require File.expand_path('../config/application', __FILE__) |
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
# Q1: Given this scenario, how would you go about returning the answer of life anytime the method answer_to_life is called? | |
# https://gist.github.com/7e676b9a9e6c9d47c319 | |
# The cleanest way to have all classes you mentioned (which of course are objects) possess the same method is to find a common | |
# superclass they share, from which they inherit. Since we are dealing with a miriad of Classes (NilClass, String, FixNum) they | |
# all share the superclass of 'Class' so I modified it to contain the method. | |
class Object | |
def answer_to_life | |
42 |
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
1. Unicorn: The joys of multithreading and performance gains from heroku and unicorn. I will discuss the threaded approach vs the traditional heroku setup. I will also discuss pitfalls including managing each thread and forcing them to quit or close when idle. | |
2. Postgres Locally: Why one should set up PG locally (ie for debug issues), my cautionary tale, and the actual process updated and also including how to uninstall and reinstall. | |
3. Media queries continued: I would like to go into detail in taking a 2 column layout and forming it into a one column form for easier viewing. | |
4. Big O notation explained: A quick overview of big0 and why we need to use and understand it. Add relevent types including sort styles and other basic algorythm notations. | |
5. Preparing for a boot camp: Code School, the Rails tutorial, where to find ruby sample problems. Fizzbuzz. How to get ready. |
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 encoder = { | |
setMessage: function() { | |
this.message = document.getElementById('message').value; | |
}, | |
getPassword: function() { | |
this.password = prompt("Enter your Decoder Password: "); | |
}, | |
setUrl: function() { | |
totalURL = document.URL + "?" + | |
encodeURI(this.encrypt()); |
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
function Computer(name, brand, year, color) { | |
this.name = name; | |
this.brand = brand; | |
this.year = year; | |
this.color = color; | |
}; | |
Computer.prototype.toString = function () { | |
return "The computer is a(n) " + this.brand + | |
" made in " + this.year + ". " + |
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
<td><%= button_to 'Approve', post_comment_path(comment, comment: { approved: true }), method: :put, class: "btn" %></td> |
NewerOlder