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
var colorUtils = { | |
existingColors: {}, | |
red: [5.5, 0.765, 0.80], | |
convertHSVtoRGB: function(h, s, v) { | |
var r, g, b, i, f, p, q, t; | |
h = h / 360; | |
i = Math.floor(h * 6); | |
f = h * 6 - i; | |
p = v * (1 - s); | |
q = v * (1 - f * s); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.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
def upload_photo | |
event = Event.find(params[:event_id]) | |
params.delete(:event_id) | |
icon = EventIcon.create(params) | |
# This requires setting up a many-to-one relationship between icons and events | |
event.icons << icon | |
event.save! | |
render json: { | |
id: icon.id, | |
name: icon.photo_file_name, |
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
<script type="text/javascript"> | |
// You'll probably have to call this from $(document).ready because it requires the DOM to be loaded. | |
function bindToForm(){ | |
$("#upload-photo-form").fileupload({ | |
dataType: 'json', | |
progress: function() { | |
// Indicate that the upload has begun | |
}, | |
done: function(e, data) { | |
// use data.id, data.name, and data.url to display the photo |
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
Writer.where().each do |w| | |
start_time = Time.now | |
w.save! | |
puts w.id if (Time.now - start_time) > 3 | |
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
id_map = { | |
"soon-to-be-deleted-team-id" => "replacement-team-id", | |
"other-soon-to-be-deleted-team-id" => "other-replacement-team-id" | |
} | |
id_map.each_pair do |old_id, new_id| | |
old_id = BSON::ObjectId(old_id) | |
new_id = BSON::ObjectId(new_id) | |
classes = [BlogPost, Business, Job, FinishedJob, PitchSet, TempJob] | |
classes.each do |cl| |
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
def is_payday?(t) | |
return true if (t.end_of_month.saturday? || t.end_of_month.sunday?) && t.friday? | |
return true if [13, 14].include?(t.day) && t.friday? | |
return true if (t.end_of_month == t.midnight || t.day == 15) && !(t.saturday? || t.sunday?) | |
return false | |
end | |
@time = DateTime.now | |
100.times do |i| | |
t = @time.advance(days: i) |
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
## On BuyerEmailer | |
# Now we don't have to call it in every method... | |
sendgrid_category 'buyer' | |
# This is the hash that connects preference levels to emails | |
@@preference_levels = { | |
claimed: "important" | |
} |
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
[ | |
["Initial Draft", "First draft of first piece of content==========abc123==========First draft of second piece of content"], | |
["Second Draft", "Second draft of first piece of content==========abc123==========Second draft of second piece of content"], | |
["Final Draft", "Final draft of first piece of content==========abc123==========Final draft of second piece of content"] | |
] |
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
query = {:per_page=>15, :page=>1, :blacklisted=>false, :not_team_ids=>["5090770bd6841267b10004b4"], :search_terms=>nil, :sort=>[:team_scores_5090770bd6841267b10004b4_num_overall, :desc]} | |
solrquery = Writer.search do | |
all_of do | |
without(:removed).equal_to(true) | |
without(:blacklisted).equal_to(true) if query[:blacklisted] == false | |
with(:has_photo).equal_to(true) if query[:has_photo] | |
with(:team_ids).any_of(query[:team_ids]) if query[:team_ids] | |
without(:team_ids).any_of(query[:not_team_ids]) if query[:not_team_ids] | |
with(:group_ids).any_of([query[:group_ids]]) if query[:group_ids] | |
end |