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
int * sort (int arr [], int len) { | |
for (int i = 1; i < len; i++) { | |
int key = arr[i]; | |
int j = i - 1; | |
while (j >= 0 && arr[j] > key) { | |
arr[j + 1] = arr[j]; | |
j = j - 1; | |
} |
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
let start = time::now(); | |
let metadata = try!(fs::metadata(&path)); | |
let mut file = try!(File::open(&path)); | |
let mut buf = vec![0u8; metadata.len() as usize]; | |
try!(file.read(&mut buf)); | |
buf.make_ascii_lowercase(); | |
let mut str: &str = try!(str::from_utf8(&buf)); |
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
export default ({nestedPhoto}) => { | |
return ( | |
<PhotoCard | |
dispatch={(action) => nestedPhoto(action, {id: blah})} | |
/> | |
<Viewer | |
/* ???? needs to dispatch some to nestedPhoto and some to the parent of nestedPhoto */ | |
/> | |
); | |
} |
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 UploadFileToken(props) { | |
var ce = React.createElement; | |
var file = props.file; | |
return ce('div', | |
{ | |
className: 'procore-upload-file-token', | |
key: file.uuid, | |
}, | |
ce('span', { |
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
import JQueryTypeDropdown from './JQueryTypeDropdown.jsx' | |
import FoundationTypeDropdown from './FoundationTypeDropdown.jsx' | |
const App = () => { | |
return ( | |
<div> | |
<JQueryTypeDropdown /> | |
<FoundationTypeDropdown /> | |
</div> | |
); |
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 ProstoreFile < ActiveRecord::Base | |
... | |
include ProstoreFile::UrlHelpers | |
... | |
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
def self.find_optimal_batch_size | |
times = [] | |
[100, 1_000, 10_000, 100_000].each do |batch_size| | |
times << [timed_query(batch_size), batch_size] | |
end | |
times.sort | |
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 ClearCachedDrawingRevisionZipUrl | |
def self.clear_drawing_revision_zip_urls_for_companies(company_ids) | |
Company.where(id: company_ids).each do |company| | |
DrawingRevision. | |
joins("JOIN drawing_areas ON drawing_areas.id = drawing_revisions.drawing_area_id"). | |
joins("JOIN projects ON projects.id = drawing_areas.project_id"). | |
joins("JOIN companies ON companies.id = projects.company_id"). | |
update_all(zip_url: nil) | |
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 RebuildDrawingRevisionZipUrls | |
def self.rebuild_drawing_revision_zip_urls_for_companies(company_ids) | |
Company.where(id: company_ids, use_govcloud: true).each do |company| | |
DrawingRevision.joins(drawing_area: {project: :company}). | |
where("drawing_revisions.zip_url IS NOT NULL AND companies.id = ?", company.id). | |
find_each do | drawing_revision | | |
zip_url = build_url(drawing_revision.s3_zip_key, drawing_revision.zip_profile) | |
drawing_revision.update_column('zip_url', zip_url) if zip_url | |
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
module StorageProfileKey | |
# This class backfills storage_profile_key on prostore_file_thumbnails. | |
# Once the backfill completes and there is a not null constraint | |
# and default value on the column, this class can be removed. | |
class ProstoreFileThumbnailsBackfillWorker | |
include Sidekiq::Worker | |
sidekiq_options queue: :data_migration | |
def self.enqueue_prostore_file_thumbnails(starting_id:, ending_id:) |
OlderNewer