query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
At some point the path for the url changed, and image_file_name field was used instead of filename field to save file names. So filename field is checked to decide which path (file name) to pass to url_for
def url doomsday = Time.mktime(2038, 1, 18).to_i unless self.filename.nil? AWS::S3::S3Object.url_for(image_file_name, 'xposers_interieurs', :expires => doomsday) else names = image_file_name.split(".") extension = names.pop file = "#{self.id}_#{names.join(".")}_normal.#{extension}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_url\n self.filename.url \n end", "def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end", "def stable_image_url(image_name, style = nil, options ...
[ "0.6547456", "0.6491058", "0.6394648", "0.6394648", "0.6388207", "0.6388207", "0.6294667", "0.6192745", "0.61772525", "0.61605734", "0.6151859", "0.6142537", "0.614074", "0.60681653", "0.60532355", "0.6040766", "0.60260624", "0.60146326", "0.59966093", "0.5988722", "0.5980919...
0.6180325
8
Somehow width and height are not saved anymore on database This method gets new images dimensions or return the object if they are already on db
def dimensions unless self.width geo = Paperclip::Geometry.from_file(self.url) self.update_attributes({ width: geo.width, height: geo.height }) geo else self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_dimensions\n return unless image?\n tempfile = image.queued_for_write[:original]\n\n # Silently return, if there's no `width` and `height`\n # Prevents old migrations from crashing\n return unless self.respond_to?(:width) && self.respond_to?(:height)\n\n # Works with uploaded files an...
[ "0.76018834", "0.74807245", "0.7399066", "0.7315202", "0.7285097", "0.7159443", "0.7116285", "0.7103094", "0.7063641", "0.69836885", "0.69836885", "0.6956647", "0.69456977", "0.688273", "0.68061113", "0.6796199", "0.6729863", "0.6722092", "0.6709568", "0.6689291", "0.66759044...
0.7375299
3
GET /pf_masters GET /pf_masters.json
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @masters = Master.all\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def index\n @pagemasters = Pagemaster.all\n end", "def index\n @source_masters = SourceMaster.all\n end", "def index\n @financer_masters = FinancerMaster.all...
[ "0.6764327", "0.6650141", "0.6473205", "0.6394731", "0.63109815", "0.63002956", "0.6289997", "0.62793046", "0.62748593", "0.62554175", "0.60236275", "0.6023623", "0.6019759", "0.6003205", "0.6000938", "0.59998405", "0.5997004", "0.5964161", "0.59329015", "0.5916788", "0.58909...
0.0
-1
GET /pf_masters/1 GET /pf_masters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @masters = Master.all\n end", "def index\n @masters = Master.all.paginate(page: params[:page], per_page: 200)\n end", "def show\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @childmaster }...
[ "0.6610397", "0.64207023", "0.62925184", "0.61857164", "0.6181628", "0.6170446", "0.61213404", "0.6102081", "0.60991603", "0.60890645", "0.6078714", "0.60728693", "0.60635775", "0.59468466", "0.5934609", "0.59057355", "0.5903209", "0.59015113", "0.58904815", "0.5883151", "0.5...
0.0
-1
POST /pf_masters POST /pf_masters.json def create
def create components = params[:components] str = '' i = 0 components.each do |c| str = if i == 0 c.to_s else str.to_s + ',' + c.to_s end i += 1 end @pf_master = PfMaster.new(pf_master_params) @pf_master.base_component = str ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @maker_master = MakerMaster.new(maker_master_params)\n\n respond_to do |format|\n if @maker_master.save\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully created.' }\n format.json { render :show, status: :created, location: @maker_master }\n ...
[ "0.7278424", "0.7220703", "0.7131541", "0.6883542", "0.68804616", "0.68715227", "0.6815272", "0.68142915", "0.67825586", "0.6738799", "0.66845644", "0.66749495", "0.66464984", "0.6594921", "0.65860885", "0.65480965", "0.6544236", "0.6541436", "0.6532903", "0.64955", "0.649421...
0.61564344
33
PATCH/PUT /pf_masters/1 PATCH/PUT /pf_masters/1.json
def update components = params[:components] str = '' i = 0 components.try(:each) do |c| str = if i == 0 c.to_s else str.to_s + ',' + c.to_s end i += 1 end @pf_master.base_component = str @pf_master.update(pf_master_params) @...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @master.update(master_params)\n format.html { redirect_to @master, notice: 'Master was successfully updated.' }\n format.json { render :show, status: :ok, location: @master }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.64944106", "0.6366972", "0.6269754", "0.6237951", "0.62367755", "0.619769", "0.61586547", "0.60445654", "0.60303044", "0.60130745", "0.59735197", "0.59561896", "0.5922181", "0.5874796", "0.5851543", "0.5839084", "0.58192074", "0.57999086", "0.5782099", "0.5763177", "0.5760...
0.5383998
88
DELETE /pf_masters/1 DELETE /pf_masters/1.json
def destroy @pf_master.destroy @pf_masters = PfMaster.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end", "def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirec...
[ "0.7299831", "0.70678633", "0.6976009", "0.6958782", "0.6953363", "0.6868318", "0.68598706", "0.6858471", "0.68313354", "0.68206155", "0.6818446", "0.68013716", "0.6793516", "0.67849004", "0.678181", "0.67515516", "0.67308104", "0.6724851", "0.66910845", "0.6672181", "0.66644...
0.6803358
11
Use callbacks to share common setup or constraints between actions.
def set_pf_master @pf_master = PfMaster.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pf_master_params params.require(:pf_master).permit(:is_confirm,:is_pf, :is_da,:percentage, :date_effective, :min_limit, :base_component, :is_active) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns Submit or Create depending if the object is saved
def submit_text(object) if object.persisted? "Update" else "Create" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\r\n new? ? create : update\r\n end", "def save\n new? ? create : update\n end", "def save\n new? ? create : update\n end", "def save\n new? ? create : update\n end", "def submit(value = nil, options = {})\n value = (@object.new_record?? \"Create\" : \"Update\")...
[ "0.71668845", "0.7103563", "0.7103563", "0.7103563", "0.693245", "0.68320656", "0.67804015", "0.66317636", "0.6525611", "0.6486721", "0.6478328", "0.6444524", "0.64327323", "0.6408301", "0.63626075", "0.6342853", "0.6336407", "0.6336407", "0.6336407", "0.6336407", "0.6336407"...
0.7453367
0
Returns params for ?guest_token=... if applicable
def guest_params(user) if user.stub? { token: user.guest_token } else {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guest_params\n params.fetch(:guest, {})\n end", "def guest_params\n params[:admin_guest]\n end", "def guestlist_params\n params[:guestlist]\n end", "def guest_chat_token_params\n params.require(:guest_chat_token).permit(:chat_login, :chat_password)\n end", "def guest_params\...
[ "0.74603987", "0.7319752", "0.6844373", "0.63735086", "0.63537484", "0.6221897", "0.6188994", "0.61513394", "0.610647", "0.6068266", "0.6055945", "0.5993045", "0.5938909", "0.59145844", "0.5845915", "0.5843309", "0.5814709", "0.57605547", "0.57490546", "0.5719928", "0.5693019...
0.787876
0
If the link points to the current page, give it a different style
def current_page_link(path) "current-page" if current_page?(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to_if_current(text, page, active_class: \"active\")\n if page == current_page\n link_to text, page.request_path, class: active_class\n else\n link_to text, page.request_path\n end\n end", "def link_to_with_current name, options = {}, html_options={}\n dup_options = html_options.du...
[ "0.66896594", "0.64126074", "0.6333156", "0.6273394", "0.625458", "0.6239441", "0.6229128", "0.6198249", "0.61166865", "0.61119145", "0.60959566", "0.6066583", "0.6051935", "0.60186386", "0.5926466", "0.5879192", "0.5866407", "0.5841445", "0.5841445", "0.5814516", "0.5801723"...
0.6490991
1
Convert URLs to links
def convert_urls_to_links(text) # url = /(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp):\/\/)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(\/[a-zA-Z0-9\&%_\.\/-~-]*)?/ # url = /( |^)http:\/\/([^\s]*\.[^\s]*)( |$)/ # while text =~ url # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urls_to_links(s)\n urls = /((https?:\\/\\/|www\\.)([-\\w\\.]+)+(:\\d+)?(\\/([\\w\\/_\\.\\-\\%]*(\\?\\S+)?)?)?)/\n s.gsub(urls) {\n if $1[-1..-1] == '.'\n url = $1.chop\n '<a href=\"'+url+'\">'+url+'</a>.'\n else\n '<a href=\"'+$1+...
[ "0.7912525", "0.78300244", "0.7563086", "0.7559657", "0.7447186", "0.7239726", "0.7229715", "0.71981406", "0.7172213", "0.713888", "0.7110849", "0.7072577", "0.7011322", "0.6919398", "0.69119257", "0.6900174", "0.687196", "0.6854802", "0.6845089", "0.6826776", "0.68085355", ...
0.8348368
0
In AnyCable, we lazily populate env by passing it through the middleware chain, so we access it via request
def env return super unless anycabled? request.env end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env\n @env ||= env_with_params\nend", "def env\n @_request.env\n end", "def env\n @request.env\n end", "def env\n @env\n end", "def build_env(connection, request); end", "def env\n @_env\n end", "def env_table\n @request.env\n e...
[ "0.76082116", "0.7299631", "0.7183019", "0.710303", "0.7043907", "0.70142597", "0.6905405", "0.6806172", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", "0.6726276", ...
0.75160986
1
Use callbacks to share common setup or constraints between actions.
def set_party @party = Party.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def party_params params.permit(:title) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
add these hardcoded previous runs to the task so we can ensure exact duplicates
def add_hardcoded_previous_runs(task) task.add_previous_run('t1 previous run 1', dt_2019_06_14_010101) task.add_previous_run('t1 previous run 2', dt_2019_06_14_020101) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_previous_runs!\n if previously_ran?\n current_run.each do |description, elapsed|\n new_times = if previous_run[description.to_s]\n Array(previous_run[description.to_s]) << elapsed\n else\n Array...
[ "0.7228653", "0.7161197", "0.7161197", "0.6676046", "0.6535609", "0.62334913", "0.6049046", "0.58384633", "0.58329546", "0.57917905", "0.5750081", "0.57480884", "0.57470727", "0.5741288", "0.57229686", "0.57180214", "0.57180214", "0.5715063", "0.5622944", "0.5588755", "0.5569...
0.83337617
0
add these hardcoded duplicates to the task so we can ensure exact duplicates
def add_hardcoded_duplicates(task) task.add_duplicate('t1 duplicate 1') task.add_duplicate('t1 duplicate 2') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @tasks_params[i.to_s][:name] == @tasks_params[j.to_s][:name]\n end\n end\n end", "def set_and_log_duplicate_tasks(evaluated_tas...
[ "0.66711116", "0.64330745", "0.63142926", "0.6121373", "0.6065582", "0.59957606", "0.5992141", "0.5736837", "0.57033527", "0.56219375", "0.5618329", "0.55899864", "0.5559679", "0.5530929", "0.5458503", "0.54560983", "0.5447529", "0.54236394", "0.5382629", "0.5380065", "0.5360...
0.84784424
0
> ROUTES Action Show Amend responses in tests Need to test validity of JSON responses etc
def show @exception = ExceptionHandler::Exception.new request #-> Service Object render status: @exception.status #-> Show apppropriate response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_response(payload); end", "def format_response(payload); end", "def test_conditional_true\n act = acl {\n respond(200) { true }\n }.call({})\n assert_equal([200, {}, []], act)\n end", "def test_should_be_json_response\n get '/mock/example'\n assert_equal las...
[ "0.6156939", "0.6156939", "0.61159676", "0.6082813", "0.59964824", "0.5970375", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.5945898", "0.59207827", "0.5910545", ...
0.0
-1
Somehow the introduction of Parallel seems to have caused a circular loading problem. Why, I do not understand, since the entire environment should be loaded before the parallel section is reached (when we run this via a rake task we require the environment), and no where else do I ever see a problem, even with other u...
def circular_loading_kludge Rails.application.eager_load! # CfsFile # CfsDirectory # FileGroup # BitLevelFileGroup # Collection # FileExtension # FixityCheckResult end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def rake_eager_load; end", "def rake_eager_load; end", "def eager_load; end", "def eager_load; end", "def eager_load; end", "def eager_load=(_arg0); end", "def eager_load=(_arg0); end", "def eager_...
[ "0.6533072", "0.6533072", "0.6533072", "0.6533072", "0.6506191", "0.6506191", "0.6470236", "0.6470236", "0.6470236", "0.6241473", "0.6241473", "0.6241473", "0.62285334", "0.6215433", "0.6215433", "0.594549", "0.58320725", "0.58274144", "0.5791872", "0.5786436", "0.57276976", ...
0.5677377
22
strips out any non alpha characters and replaces J with I
def validate_message(message) validated_message = message.gsub(/[^a-zA-Z]/, '').upcase.gsub('J','I') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_alpha(input_word)\n input_word.chars.each do |c|\n input_word.delete!(c) unless $alpha.include?(c)\n end\n return input_word\nend", "def alphafilter\n self.gsub(/[^a-zA-Z\\s]/, '')\n end", "def del_special(s)\n# gsub is an extremely useful method ! pass it a regular express...
[ "0.6933398", "0.6637995", "0.65057284", "0.6493307", "0.6488613", "0.6461332", "0.64390916", "0.64287704", "0.64146966", "0.64038885", "0.64038885", "0.63945955", "0.63726634", "0.6343446", "0.62999654", "0.62317514", "0.62287235", "0.6215974", "0.6209091", "0.6203319", "0.61...
0.6469724
5
Override the default to_json method This stops rendering users from showing the OAuth token and expiry
def to_json(options = {}) options[:except] ||= [:oauth_token, :oauth_expires_at] options[:include] ||= [:gifts] super(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json\n options[:except] ||= %i(created_at updated_at oauth_expires_at oauth_token tokens)\n super(options)\n end", "def as_json(options = {})\n super(options.merge({ except: [:auth_token, :created_at, :updated_at] }))\n end", "def as_json(*)\n super(except: %i[password_digest created...
[ "0.74876183", "0.7181572", "0.6930304", "0.6773187", "0.66236484", "0.65957594", "0.6571941", "0.65584683", "0.65211207", "0.6498142", "0.64706904", "0.6461692", "0.6440311", "0.6422958", "0.6422958", "0.6419488", "0.6419488", "0.6414182", "0.6402727", "0.63948905", "0.632073...
0.7256011
1
This one is called within association calls. No need to dump in all the nested stuff!
def serializable_hash(options = nil) options ||= {} # Following Rails implementation options[:except] ||= [:oauth_token, :oauth_expires_at] super(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_association_replicants(dumper, association)\n if reflection = self.class.reflect_on_association(association)\n objects = __send__(reflection.name)\n dumper.dump(objects)\n if reflection.macro == :has_and_belongs_to_many\n dump_has_and_belongs_to_many_replicant(...
[ "0.6356287", "0.6349778", "0.6344082", "0.6263678", "0.6200498", "0.6116929", "0.6045667", "0.60440236", "0.60036206", "0.5962245", "0.59486485", "0.5913444", "0.5899025", "0.5875291", "0.5837189", "0.58243674", "0.5820856", "0.57706785", "0.57050157", "0.5701829", "0.5698304...
0.0
-1
On create, the user's name is stored in our system
def get_name name = Koala::Facebook::API.new(oauth_token).get_object('me?fields=name')['name'] update(name: name) name rescue Koala::Facebook::AuthenticationError # Do nothing. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n userName\n end", "def set_user_name_field(user_name)\n end", "def user_name=(name)\n self.user = User.find_or_create_by(name: name)\n end", "def name\n\t self.username\n end", "def user_name\n name = self.le_user.nil? ? '' : self.le_user.name\n end", "def user_name\n ...
[ "0.74301434", "0.74143225", "0.738422", "0.7227445", "0.7205388", "0.7202368", "0.71837944", "0.71551245", "0.7149612", "0.7149612", "0.7145499", "0.7136522", "0.7128028", "0.7032193", "0.7032193", "0.70001256", "0.6978826", "0.6957128", "0.69489324", "0.69471574", "0.6947157...
0.0
-1
On create, the user's birthday is stored in our system This allows us to provide the functionality of retrieving the user's friends' birthdays On failure (user somehow hides the birthday completely / UID is invalid), do nothing If a user's birthday is already in our system, returns it immediately
def get_birthday return birthday if birthday birthday = Date.strptime(Koala::Facebook::API.new(oauth_token).get_object('me?fields=birthday')['birthday'], '%m/%d/%Y') update(birthday: birthday) birthday rescue Koala::Facebook::AuthenticationError # Don't do anything. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_my_birthday # rubocop:todo Metrics/MethodLength\n if message.text.nil?\n prompt_user '/add_my_birthday', true, false, false\n else\n\n @user_details[:chat_id] = message.chat.id\n @user_details[:sex] = @sex\n valid = true\n first_name = message.from.nil? ? 'channel' : message....
[ "0.7218196", "0.7151002", "0.7120216", "0.70032173", "0.6672984", "0.6649312", "0.6602333", "0.6583616", "0.6573961", "0.65308845", "0.652863", "0.64831406", "0.6467584", "0.6453987", "0.64247954", "0.6393968", "0.6393968", "0.63558245", "0.6348783", "0.6348684", "0.630115", ...
0.7656121
0
Returns the number of days between a given date and the beginning of the year
def ordinal_date(date) date - date.beginning_of_year end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_year(year = current.year)\n days_in_month(2, year) + 337\n end", "def days_in_year(year)\n Time.days_in_month(2, year) + 337\n end", "def days_in_year(year)\n ::Montrose::Utils.days_in_month(2, year) + 337\n end", "def days_in_year\n return Datet.days_in_year(@t_yea...
[ "0.7870514", "0.7857364", "0.7846845", "0.77508134", "0.7733351", "0.77017313", "0.76414794", "0.76147014", "0.7529374", "0.7427013", "0.7405678", "0.7228194", "0.68917626", "0.68842393", "0.68349236", "0.681754", "0.67717004", "0.6747155", "0.6690996", "0.66861963", "0.66279...
0.66693807
20
Helper method to return an array in the form of [string_to_replace, replace_str]
def stringDiff(singular, plural) if !singular.empty? && !plural.empty? && singular[0] == plural[0] stringDiff(singular[1..-1], plural[1..-1]) else return [singular, plural] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_replacements\nend", "def replaces\n @replaces ||= []\n end", "def replaces\n @replaces ||= []\n end", "def as_replacements; end", "def as_replacements; end", "def as_replacements; end", "def replaceAll(oldStr,newStr)\n while @container.index(oldStr)!=nil\n ...
[ "0.68221825", "0.6673563", "0.6673563", "0.65323836", "0.65323836", "0.65323836", "0.6411898", "0.63378847", "0.619048", "0.61524266", "0.61128277", "0.61128277", "0.61128277", "0.61128277", "0.608178", "0.6013963", "0.5995853", "0.5919591", "0.57799864", "0.5681874", "0.5567...
0.0
-1
Should display random metrics
def report raise "Calling Abstract method report on class Heuristic." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect(metrics)\n metrics[:polled_total] = rand(100)\n metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def performance_test(params = {})\n length_bv = params[:length] ? params[:length] : rand(1000..10000).to_i \n distribution = params...
[ "0.63047963", "0.6087561", "0.6087561", "0.6087561", "0.60875577", "0.6084868", "0.60328805", "0.59844595", "0.5956482", "0.5956482", "0.5933416", "0.5918268", "0.5916519", "0.5887313", "0.5867195", "0.5857214", "0.58343935", "0.5823203", "0.58088213", "0.5807574", "0.5806976...
0.0
-1
will determine which match to used based on the fitness
def fitness(matches) max_match = matches[0] matches.each do |match| if max_match[2] < match[2] max_match = match end end return max_match end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_fitness(self_survey, user_survey)\n fitness = 0\n if self_survey.sociality == user_survey.sociality then fitness += 1 end\n if self_survey.familiarity == user_survey.familiarity then fitness += 1 end\n if self_survey.awaken == user_survey.awaken then fitness += 1 end\n if self_survey.sm...
[ "0.6995827", "0.6925817", "0.6657553", "0.65505916", "0.6541016", "0.6512711", "0.65114236", "0.6420425", "0.641139", "0.641139", "0.64014566", "0.64014566", "0.6373138", "0.63600856", "0.63049257", "0.6252032", "0.6252032", "0.62222797", "0.62106884", "0.6190955", "0.6163119...
0.75469875
0
GET /asset_categories GET /asset_categories.xml
def index @asset_categories = AssetCategory.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @asset_categories } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @asset_categories = AssetCategory.all\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def get_categories\r\n categories = Taxonomy.get...
[ "0.73304725", "0.70920545", "0.6848569", "0.67133856", "0.67108727", "0.6658787", "0.66415936", "0.65923434", "0.6586922", "0.6586922", "0.64985824", "0.6489741", "0.64784926", "0.647335", "0.6461316", "0.6448857", "0.6404989", "0.6396437", "0.63733083", "0.6372986", "0.63655...
0.75976634
0
GET /asset_categories/1 GET /asset_categories/1.xml
def show @asset_category = AssetCategory.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @asset_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @asset_categories = AssetCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asset_categories }\n end\n end", "def index\n @asset_categories = AssetCategory.all\n end", "def get_categories\n body = build_request(29...
[ "0.76151377", "0.70266527", "0.6926283", "0.667639", "0.66695476", "0.66695476", "0.66672724", "0.6551264", "0.6481997", "0.64155084", "0.6407759", "0.6398311", "0.6388867", "0.63587624", "0.6345144", "0.63238806", "0.62876564", "0.6247967", "0.6230912", "0.62161803", "0.6192...
0.7028626
1
GET /asset_categories/new GET /asset_categories/new.xml
def new @asset_category = AssetCategory.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @asset_category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tag = @category.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def create\n @asset_category = AssetCategory.new(params[:asset_category])\n\n respond_to do |format|\n if @asset_category.save\n f...
[ "0.7293418", "0.7281984", "0.7194795", "0.71737784", "0.71417403", "0.71417403", "0.71417403", "0.71417403", "0.71259946", "0.710387", "0.7079358", "0.70413464", "0.70397705", "0.7026194", "0.6946686", "0.68608344", "0.68331164", "0.6831302", "0.682979", "0.6804539", "0.67796...
0.7779302
0
POST /asset_categories POST /asset_categories.xml
def create @asset_category = AssetCategory.new(params[:asset_category]) respond_to do |format| if @asset_category.save flash[:success] = 'Asset category was successfully created.' format.html { redirect_to(admin_asset_categories_url) } format.xml { render :xml => @asset_category,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @asset_category = AssetCategory.new(asset_category_params)\n\n respond_to do |format|\n if @asset_category.save\n format.html { redirect_to @asset_category, notice: 'Asset category was successfully created.' }\n format.json { render :show, status: :created, location: @asset_ca...
[ "0.65681726", "0.6207561", "0.60766745", "0.6025973", "0.596471", "0.5954637", "0.5916933", "0.5913267", "0.5902884", "0.5832809", "0.57738644", "0.57499665", "0.5740694", "0.5727338", "0.5707199", "0.56992185", "0.5694759", "0.5692284", "0.56922346", "0.5676738", "0.56594133...
0.6779728
0
PUT /asset_categories/1 PUT /asset_categories/1.xml
def update @asset_category = AssetCategory.find(params[:id]) respond_to do |format| if @asset_category.update_attributes(params[:asset_category]) flash[:success] = 'Asset category was successfully updated.' format.html { redirect_to(admin_asset_categories_url) } format.xml { head...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @asset_categorization.update_attributes(params[:asset_categorization])\n format.html { redirect_to @asset_categorization, notice: I18n.t('controllers.update_success', name: @asset_categorization.class.model_name.human) }\n format.json { head :no_conten...
[ "0.63472885", "0.6278111", "0.62043357", "0.61943066", "0.6177013", "0.5917215", "0.58740926", "0.5792261", "0.5774241", "0.5722498", "0.56799585", "0.56707907", "0.56637794", "0.56373405", "0.56284666", "0.5625989", "0.56040007", "0.56039226", "0.5578558", "0.55731493", "0.5...
0.66030294
0
DELETE /asset_categories/1 DELETE /asset_categories/1.xml
def destroy @asset_category = AssetCategory.find(params[:id]) @asset_category.destroy respond_to do |format| flash[:success] = 'Asset category was successfully deleted.' format.html { redirect_to(admin_asset_categories_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asset_category.destroy\n respond_to do |format|\n format.html { redirect_to asset_categories_url, notice: 'Asset category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @ccategory = Ccategory.find(params[:id])\r\n @ccatego...
[ "0.6810435", "0.6769386", "0.67408425", "0.6712644", "0.6679124", "0.6672792", "0.6658619", "0.6610906", "0.66087884", "0.6599163", "0.65935236", "0.65858495", "0.65810347", "0.65788835", "0.6578772", "0.6565506", "0.6561242", "0.654722", "0.6543051", "0.6533039", "0.6533039"...
0.7346492
0
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to s...
[ "0.7506824", "0.73663765", "0.7332821", "0.73327106", "0.73037416", "0.7298738", "0.7278256", "0.7278256", "0.7278256", "0.726972", "0.724515", "0.7229496", "0.7226015", "0.7201818", "0.71871907", "0.7179181", "0.7165332", "0.7150624", "0.7150624", "0.7150624", "0.7150624", ...
0.0
-1
Provide a default URL as a default if there hasn't been a file uploaded: def default_url "/images/fallback/" + [version_name, "default.png"].compact.join('_') end process :resize_to_fit => [1000, 1000] Process files as they are uploaded: process :scale => [200, 300] def scale(width, height) do something end
def cropper(crop_width, crop_height) manipulate! do |img| width = img.columns height= img.rows if width == crop_width and height==crop_height then img else img.crop(width / 2,height / 2,crop_width,crop_height) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_url\n #\"/assets/fallback/\" + [version_name, \"default.jpg\"].compact.join('_')\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.jpg\"].compact.join('_'))\n #\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def default_url\n ...
[ "0.6750901", "0.6727883", "0.66818106", "0.66788316", "0.6671621", "0.66094387", "0.6598813", "0.6583502", "0.6580459", "0.6572872", "0.65550846", "0.6551745", "0.6548032", "0.65385234", "0.6524191", "0.65139014", "0.65075845", "0.6502124", "0.6500802", "0.6475715", "0.646946...
0.0
-1
version :product_slider do process :resize_to_fill => [651, 340] end version :advertisement do process :resize_to_limit => [140, 140] end Add a white list of extensions which are allowed to be uploaded. For images you might use something like this: def extension_white_list %w(jpg jpeg gif png) end Override the filename...
def pdf?(file) File.extname(current_path).upcase == ".PDF" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_params\n params.require(:product).permit(:name, :description, :total_frames, :file_extension, \n :display_width, :display_height, {images: []})\n end", "def uploader_options\n end", "def main_slider_params\n params.require(:main_slider).permit(:n...
[ "0.6168713", "0.6065292", "0.58714813", "0.5834942", "0.58295053", "0.5779961", "0.5737406", "0.57262754", "0.5707742", "0.5703619", "0.569536", "0.5693822", "0.5690058", "0.5689007", "0.56878823", "0.5669057", "0.5666276", "0.56446373", "0.56070006", "0.5564895", "0.5557833"...
0.0
-1
Refresh staked cofi transactions by querying etherscan
def perform # Since `is_txn_confirmations_gte_10` is the only field that may change, we can limit our query # to use that as a starting block earliest_unconfirmed_block_number = StakedCofiTransaction .where(is_txn_confirmations_gte_10: false) .order(txn_block_number: :asc) .select(:txn_blo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eth_pendingTransactions()\r\n response = do_request(\"eth_pendingTransactions\")\r\n response[\"result\"]\r\n end", "def index\n @contracts = Contrato.all\n\n # geth attach ipc:\\\\.\\pipe\\geth.ipc\n client = Ethereum::IpcClient.new(\"\\\\\\\\.\\\\pipe\\\\geth.ipc\", false)\n client2 = E...
[ "0.58948463", "0.58076316", "0.5601986", "0.55928934", "0.5583249", "0.5470468", "0.54554975", "0.54486877", "0.54239964", "0.5409582", "0.5379924", "0.5357023", "0.5297588", "0.52386004", "0.52386004", "0.52386004", "0.52386004", "0.52386004", "0.52386004", "0.52386004", "0....
0.6559904
0
Analyze given data data structure and types names is an Arrany.new type of String values. Reading and Accessing names[0] = 'demo' < Type String Create type to store return data. Can use Array or Hash data structures Let's go with array Begin method
def my_anagram(type_array) #Create Hash container storage_hash = {} #Take given array argument and opperate on each element. #Anagrams are words that can be spelled using the same letters. Order inmaterial. #Split text into Array / Sort String.split("") Array using Array.sort. / String.join #Iterate o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_by_name(arr)\nreturn arr.map { |hash| hash[\"name\"] }\nend", "def map_by_name(arr)\n \tnew_arry = []\n\tarr.map {|i| new_arry << i[\"name\"]}\n return new_arry\nend", "def map_by_name(arr)\n new_arr = []\n arr.each do |ele|\n new_arr << ele[\"name\"]\n end\n return new_arr\nend", ...
[ "0.5915778", "0.5834534", "0.5802045", "0.5667121", "0.5611702", "0.5588709", "0.55441856", "0.554087", "0.55148584", "0.55108047", "0.54247934", "0.54005075", "0.5399321", "0.52298623", "0.52088535", "0.5205418", "0.5183331", "0.5183114", "0.51634234", "0.5159748", "0.514344...
0.0
-1
returns all user information as single string
def to_s { fullname: fullname, address: address, dob: dob, email: email, username: username }.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend", "def to_s\n \"[User: #{get_full_name} - #{email} ID: #{id}]\"\n end", "def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => us...
[ "0.78393996", "0.76584953", "0.7518116", "0.75093156", "0.74372536", "0.73476964", "0.7275547", "0.7256636", "0.72526973", "0.71860534", "0.71620893", "0.7142807", "0.71139437", "0.7058843", "0.7030326", "0.7027403", "0.7027403", "0.70143557", "0.70124006", "0.7005606", "0.70...
0.6735577
50
validates :phone , presence: false, confirmation: false
def to_param username end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phone_present\n if phone.blank?\n errors.add(:phone, \"Can't be empty\")\n end\n end", "def validate\n validates_presence([:name, :phone])\n end", "def parent_phone_is_valid\n errors.add(:parent_phone, \"Parent phone is not blank and it is not a valid 10 digit phone number.\") unless par...
[ "0.7673466", "0.73329747", "0.7307612", "0.72402006", "0.7109799", "0.70745105", "0.69849145", "0.6931912", "0.6714463", "0.66973615", "0.6664935", "0.6656588", "0.6610066", "0.6565173", "0.6525976", "0.65250236", "0.6524762", "0.65006727", "0.6499626", "0.64129984", "0.64078...
0.0
-1
GET /recipesources/1 GET /recipesources/1.json
def show @recipesource = Recipesource.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @recipesource } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub(...
[ "0.65055436", "0.64108586", "0.64019394", "0.6394902", "0.63949007", "0.63685465", "0.626481", "0.61703444", "0.6169353", "0.5993488", "0.5967844", "0.5927712", "0.5910931", "0.5896937", "0.58126676", "0.58033717", "0.58018804", "0.5780845", "0.57573617", "0.57570666", "0.573...
0.7464179
0
GET /recipesources/new GET /recipesources/new.json
def new @recipesource = Recipesource.new respond_to do |format| format.html # new.html.erb format.json { render json: @recipesource } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @recipesource = Recipesource.new(params[:recipesource])\n\n respond_to do |format|\n if @recipesource.save\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully created.' }\n format.json { render json: @recipesource, status: :created, location: @rec...
[ "0.7066495", "0.6730347", "0.6723771", "0.63934046", "0.6374817", "0.6357259", "0.62945133", "0.62945133", "0.62945133", "0.62945133", "0.62945133", "0.62692684", "0.62286496", "0.6220419", "0.6219498", "0.6196653", "0.6179583", "0.61009437", "0.6100426", "0.60857815", "0.607...
0.7780013
0
POST /recipesources POST /recipesources.json
def create @recipesource = Recipesource.new(params[:recipesource]) respond_to do |format| if @recipesource.save format.html { redirect_to @recipesource, notice: 'Recipesource was successfully created.' } format.json { render json: @recipesource, status: :created, location: @recipesource }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @recipesource = Recipesource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipesource }\n end\n end", "def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_pos...
[ "0.63680637", "0.6175835", "0.6078958", "0.58788574", "0.58065313", "0.57959265", "0.57870615", "0.57103854", "0.5546981", "0.5484927", "0.5483505", "0.5433528", "0.5412882", "0.5408264", "0.5403347", "0.53987986", "0.53914386", "0.53725654", "0.53411764", "0.5314573", "0.528...
0.69824046
0
PUT /recipesources/1 PUT /recipesources/1.json
def update @recipesource = Recipesource.find(params[:id]) respond_to do |format| if @recipesource.update_attributes(params[:recipesource]) format.html { redirect_to @recipesource, notice: 'Recipesource was successfully updated.' } format.json { head :no_content } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n ...
[ "0.6327309", "0.6193699", "0.613099", "0.61012113", "0.60752535", "0.6074113", "0.60669553", "0.60075605", "0.5943164", "0.5857985", "0.5857985", "0.58563566", "0.58563566", "0.58225536", "0.58173525", "0.57768327", "0.5775122", "0.5761432", "0.57426435", "0.57298803", "0.572...
0.70229536
0
DELETE /recipesources/1 DELETE /recipesources/1.json
def destroy @recipesource = Recipesource.find(params[:id]) @recipesource.destroy respond_to do |format| format.html { redirect_to recipesources_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n...
[ "0.7021637", "0.7021637", "0.7021407", "0.68295115", "0.67696804", "0.6722827", "0.6721417", "0.6668262", "0.6667618", "0.6666793", "0.666062", "0.66355985", "0.66355985", "0.66355985", "0.66355985", "0.65546435", "0.65515375", "0.65421927", "0.65407616", "0.65307164", "0.653...
0.7984122
0
GET /fathers/1 GET /fathers/1.json
def show @father = Father.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @father } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "def show\n begin\n @fucker = Fucker.find(params[:i...
[ "0.6388127", "0.61391854", "0.59871936", "0.5895403", "0.5866028", "0.57834905", "0.5777708", "0.5750485", "0.5732148", "0.57213116", "0.57050157", "0.57018346", "0.5691693", "0.56851494", "0.56756216", "0.56503284", "0.5643126", "0.56402886", "0.56379986", "0.5634167", "0.56...
0.5675091
15
GET /fathers/new GET /fathers/new.json
def new @father = Father.new respond_to do |format| format.html # new.html.erb format.json { render json: @father } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n...
[ "0.71028596", "0.69911903", "0.6974416", "0.6916181", "0.6907393", "0.6868203", "0.68472415", "0.68266344", "0.68046653", "0.6801912", "0.6790242", "0.6788681", "0.67758054", "0.6772236", "0.6740919", "0.673236", "0.67323124", "0.67200774", "0.67029727", "0.67027134", "0.6702...
0.70612955
1
POST /fathers POST /fathers.json
def create @father = Father.new(params[:father]) respond_to do |format| if @father.save format.html { redirect_to @father, notice: 'Father was successfully created.' } format.json { render json: @father, status: :created, location: @father } else format.html { render action:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json...
[ "0.6132407", "0.5840056", "0.57945913", "0.5763305", "0.5715683", "0.56935716", "0.5668599", "0.56552774", "0.5618511", "0.55472875", "0.5544985", "0.55372876", "0.5536742", "0.55351967", "0.55322593", "0.5516037", "0.55109376", "0.55102056", "0.5494129", "0.5492534", "0.5488...
0.55064625
18
PUT /fathers/1 PUT /fathers/1.json
def update @father = Father.find(params[:id]) respond_to do |format| if @father.update_attributes(params[:father]) format.html { redirect_to @father, notice: 'Father was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update options={}\n ...
[ "0.59044385", "0.5876385", "0.57845753", "0.5721208", "0.57150507", "0.56682837", "0.5666409", "0.566059", "0.5618375", "0.56052697", "0.5602256", "0.5595127", "0.55845946", "0.55686605", "0.55207866", "0.5490083", "0.5488002", "0.54849184", "0.547265", "0.547265", "0.5458996...
0.54578584
21
DELETE /fathers/1 DELETE /fathers/1.json
def destroy @father = Father.find(params[:id]) @father.destroy respond_to do |format| format.html { redirect_to fathers_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @gather = Gather.find(params[:id])\n @gather.destroy\n\n respond_to do |format|\n format.html { redirect_to gathers_url }\n format.json { head :no_content...
[ "0.7164133", "0.67180103", "0.66532546", "0.6650173", "0.6640124", "0.6567888", "0.6508911", "0.6508911", "0.6508911", "0.6508911", "0.6498113", "0.6473439", "0.64731866", "0.6448707", "0.64401925", "0.6436024", "0.6436024", "0.64284575", "0.6422626", "0.638006", "0.6372313",...
0.6808119
1
QuestionVolume of cuboid Answer
def get_volume_of_cuboid(length, width, height) return length * width * height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_of_cube(side_length)\n volume = side_length **3\n #return volume\nend", "def volume_of_cube(length_of_the_side)\nreturn length_of_the_side.to_i**3\nend", "def volume_of_cube(length)\n return length ** 3\nend", "def volume_of_cube(length)\n return length**3\nend", "def volume_of_cube(length)\...
[ "0.7367291", "0.7343099", "0.7318199", "0.7317286", "0.7317286", "0.7305935", "0.72950006", "0.72769064", "0.72557193", "0.7247675", "0.7234339", "0.7221584", "0.72170126", "0.720791", "0.70797163", "0.7018361", "0.6943524", "0.6880771", "0.6869317", "0.6802029", "0.68005663"...
0.7478324
0
QuestionCount the monkeys Answer
def monkey_count(n) str = [] i = 1 while i <= n str.push(i) i += 1 end return str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answered_questions_count\n return 0 if survey.nil?\n survey.answered_count\n end", "def answer_count\n return @answers.length if @answers\n \n Factory.count_answers_at_machine(@location)\n end", "def question_count \n @by_question.count\n end", "def find_number_of_responses(quest...
[ "0.74384934", "0.7401301", "0.7385403", "0.70654297", "0.70654297", "0.70510715", "0.6998561", "0.6997754", "0.6974142", "0.6955613", "0.68202776", "0.6816625", "0.67935586", "0.6734144", "0.6664395", "0.66454315", "0.6634896", "0.66319144", "0.6615122", "0.6568646", "0.65470...
0.0
-1
QuestionReverse words in string Answer
def reverse(string) words = string.split(' ') words.reverse! return words.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_word_by_word_naive(s)\n words = s.split(\" \")\n my_reverse(words).join(\" \")\nend", "def q5_reverse(str)\n str.split('').reverse.join('')\nend", "def reverse_string word\n\t\treturn word.reverse\nend", "def reverse_words(sent)\n words = sent.split(\" \")\n reversed_sent = \"\"\n words.eac...
[ "0.73646057", "0.72419167", "0.723021", "0.722589", "0.72247815", "0.72227377", "0.7214631", "0.7202026", "0.7167497", "0.7123598", "0.71147156", "0.71147156", "0.7112918", "0.7091474", "0.7084469", "0.7082707", "0.7074337", "0.7074215", "0.7063993", "0.7063169", "0.7049107",...
0.6905264
60
GET /shipments/1 GET /shipments/1.xml
def show @shipment = Shipment.find(params[:id]) @goods_to_deliver = Good.find_all_by_shipment_id_and_action(@shipment.id, 'Deliver') @goods_to_pickup = Good.find_all_by_shipment_id_and_action(@shipment.id, 'Pickup') respond_to do |format| format.html # show.html.erb format.xml { render :x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ship = Ship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ship }\n end\n end", "def show\n @shipment = Shipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { r...
[ "0.7051978", "0.6916708", "0.6854674", "0.6804569", "0.6770855", "0.675952", "0.6691311", "0.6611079", "0.6610178", "0.6610178", "0.65638274", "0.656029", "0.64946127", "0.6464643", "0.64617294", "0.64480233", "0.6418879", "0.6406244", "0.63962495", "0.6383512", "0.63340664",...
0.59138113
53
GET /shipments/new GET /shipments/new.xml
def new @shipment = Shipment.new 5.times { @shipment.goods.build } respond_to do |format| format.html # new.html.erb format.xml { render :xml => @shipment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ship }\n end\n end", "def new\n @ship_methods = ShipMethods.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ship_metho...
[ "0.7649756", "0.75816464", "0.75267756", "0.7471736", "0.7288826", "0.72414994", "0.7197702", "0.7166107", "0.69986326", "0.69977814", "0.6956641", "0.6952462", "0.6952462", "0.6951268", "0.69394046", "0.6938955", "0.69229954", "0.683031", "0.6806526", "0.67939353", "0.677911...
0.6401749
44
POST /shipments POST /shipments.xml
def create @shipment = Shipment.new(params[:shipment]) respond_to do |format| if @shipment.save format.html { redirect_to(@shipment, :notice => 'Shipment was successfully created.') } format.xml { render :xml => @shipment, :status => :created, :location => @shipment } else f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_shipments\n test_url = \"https://test.panel.olzalogistic.com/api/v1\"\n test_login = 'your test login'\n test_pwd = 'your test password'\n test_language = 'cs'\n\n data = {payload: {shipmentList: [123456]}} #use real Shipment ID\n\n client = OlzaApi::Client.new(test_login, test_pwd,...
[ "0.65800047", "0.64229065", "0.6413328", "0.6305555", "0.63053805", "0.6284863", "0.6248006", "0.62438387", "0.6159002", "0.6137255", "0.6137255", "0.6135131", "0.6074019", "0.6072464", "0.60682005", "0.60626507", "0.60558116", "0.6046711", "0.604196", "0.6028093", "0.6013551...
0.6330789
3
PUT /shipments/1 PUT /shipments/1.xml
def update @shipment = Shipment.find(params[:id]) respond_to do |format| if @shipment.update_attributes(params[:shipment]) format.html { redirect_to(@shipment, :notice => 'Shipment was successfully updated.') } format.xml { head :ok } else format.html { render :action => "e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ship = Ship.find(params[:id])\n\n respond_to do |format|\n if @ship.update_attributes(params[:ship])\n flash[:notice] = 'Ship was successfully updated.'\n format.html { redirect_to(@ship) }\n format.xml { head :ok }\n else\n format.html { render :action =>...
[ "0.6950965", "0.6950965", "0.67323077", "0.673107", "0.6680618", "0.66247773", "0.6573312", "0.64895785", "0.6438179", "0.64356893", "0.641622", "0.641622", "0.6382592", "0.6377226", "0.6363474", "0.63406575", "0.6331911", "0.62675357", "0.62396526", "0.62396526", "0.6205947"...
0.6536095
7
DELETE /shipments/1 DELETE /shipments/1.xml
def destroy @shipment = Shipment.find(params[:id]) @shipment.destroy respond_to do |format| format.html { redirect_to(shipments_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { r...
[ "0.74225307", "0.74225307", "0.7176294", "0.7102271", "0.70991856", "0.70899045", "0.69664145", "0.69276965", "0.68903494", "0.68822855", "0.68655497", "0.6840538", "0.683709", "0.6674305", "0.66642123", "0.6622787", "0.66032755", "0.66028124", "0.65739924", "0.65710294", "0....
0.7193887
2
opts A slop command object (acts like superhash) :clobber remove all generated files, including iOS build :family enum of [nil, 'iphone', 'ipad'] (caseinsensitive) :flags custom build flag array (default: []) TODO: not yet implmented :focus which tests to run (default: [], meaning "all") :formatter custom formatter (de...
def initialize opts opts = opts.to_hash if opts.is_a?(Slop) self.options = opts.to_hash.tap do |o| o[:formatter] = 'passthru' if o[:verbose] o[:formatter] = select_formatter(o[:formatter]) o[:simulator] = use_simulator?(o[:simulator]) o[:family] = o[:family] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(m)\n\n case m\n when :createproj\n @args[:projectdir] = @options[m]\n @args[m] = true\n \n when :quickpkg\n # raise BoilerMakerErr.new(\"Option -Q: This option is unimplemented.\") \n @args[m] = @options[:quickpkg]\n \n when :projectdir\n unless @opti...
[ "0.617413", "0.61464775", "0.60820246", "0.60200024", "0.5964926", "0.58251923", "0.57613826", "0.5717408", "0.57022774", "0.5701581", "0.56922287", "0.56860274", "0.56569296", "0.5640522", "0.5634989", "0.56315494", "0.56078964", "0.55936396", "0.5587086", "0.5586933", "0.55...
0.5849238
5
predefined METHODS use to avoid str1.casecmp(str2) > will be false b/c return 0 if equal
def strings_equal(str1, str2) #return true if equal str1.casecmp(str2) == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_cmp(str1, str2)\n return if !str1.is_a?(String) || !str2.is_a?(String)\n\n puts str1.downcase == str2.downcase\n end", "def natcmp(str1, str2, caseInsensitive=false)\n str1 = str1.dup\n str2 = str2.dup\n compareExpression = /^(\\D*)(\\d*)(.*)$/\n\n if caseInsensitive\n s...
[ "0.7724545", "0.7310578", "0.71408963", "0.7011047", "0.6971688", "0.6918175", "0.684645", "0.67368054", "0.65059286", "0.65047157", "0.6494666", "0.6357499", "0.63508826", "0.63202655", "0.6261941", "0.624521", "0.6240398", "0.6239675", "0.6218272", "0.6197733", "0.61958367"...
0.8153021
0
TODO set level of the day on startup
def respond(event) msg = event.content # strip off the @inne++ mention, if present msg.strip!(/\A<@[0-9]*>/) # match exactly "lotd" or "eotw", regardless of capitalization or leading/trailing whitespace if msg =~ /\A\s*lotd\s*\Z/i send_level(event) return elsif msg =~ /\A\s*eotw\s*\Z/i se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_run\n self.level = :full\n self.day = \"first sun\"\n self.time = '04:00'\n end", "def daily\n logger.info \" daily\"\n end", "def day() end", "def lvlup\n day = 60*60*24\n @level += 1\n case @level\n when 1\n @rep = Time.now+day\n when 2\n @rep = T...
[ "0.7163624", "0.6801566", "0.64058065", "0.6252333", "0.6245053", "0.62333673", "0.6069579", "0.6015499", "0.60023755", "0.595624", "0.5916416", "0.5791018", "0.5791018", "0.5791018", "0.5791018", "0.5791018", "0.5791018", "0.57721305", "0.572801", "0.5721931", "0.5677422", ...
0.0
-1
takes a filter to avoid and sends the params for all of the rest
def replace_filter(new_filter = nil) filters = @current_filters.map{ |filter| unless filter[:title] == new_filter "&#{filter[:title].downcase}=#{filter[:query]}" end } filters.compact.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_parameters; end", "def filter_parameters; end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def filtered_parameters; end", "def filter_params\n params[:f] || {}\n end", "def filter_method_params\n params.fetch(:filter_method, {})\n end", "def st...
[ "0.7578655", "0.7578655", "0.72802234", "0.72802234", "0.7150144", "0.6916005", "0.6907678", "0.685266", "0.6819734", "0.6819734", "0.6813252", "0.6804952", "0.67979944", "0.6765285", "0.6740449", "0.6702738", "0.66399145", "0.6617058", "0.66017497", "0.6567311", "0.6541604",...
0.0
-1
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in TypesController. Be sure to keep this updated too.
def valid_session {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_params\n if not @params_filtered\n # these values are automatically persisted\n # via the session\n @current_map = select_param :map, :symbol => true\n @current_language = select_param :lang\n @current_scope = select_param :scope\n @current_id = select_param :id\n #...
[ "0.60280466", "0.59489983", "0.59489983", "0.5813745", "0.57647145", "0.5742782", "0.570081", "0.5688576", "0.56590843", "0.56509095", "0.5646004", "0.56382453", "0.56026566", "0.55789745", "0.5578022", "0.5551507", "0.5551507", "0.5550148", "0.55415404" ]
0.0
-1
mark a step fails, reply errors message, stop rest steps
def step_fails(response, failure) @step_failed = true flow = @flow_steps.keys.last step_no = @flow_steps[flow].size step_key = @flow_steps[flow].last failure = %{deploy faild on #{flow}(#{step_no}):#{step_key}\n} + failure response.reply(failure) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def halt\n StepResult.new(false)\n end", "def stop(message=\"\")\n step_errors << message unless message.nil? || message.empty?\n StepResult.new(false, message)\n end", "def fail\n @failed = true\n end", "def post_fail_message; end", "def fail(message=nil)\n halt(message...
[ "0.6827453", "0.6817372", "0.6594071", "0.6518507", "0.6382324", "0.6313571", "0.6312951", "0.6312715", "0.62947035", "0.6227227", "0.6200709", "0.61696565", "0.61696565", "0.61683506", "0.61683506", "0.61683506", "0.61536586", "0.61474764", "0.61317194", "0.61274314", "0.612...
0.7375486
0
Gets information about a proxied message by its message ID.
def msg_id_get(id, opts = {}) data, _status_code, _headers = msg_id_get_with_http_info(id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_details(message_id)\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}\")\n end", "def get(message_id)\r\n messages.detect { |message| message.message_id.to_s == message_id.to_s }\r\n end", "def get_message\n @reply['message']\n end", "def message_id; @message_impl....
[ "0.63910395", "0.62182647", "0.61582416", "0.60901666", "0.5947086", "0.59081453", "0.5879912", "0.5849715", "0.5796156", "0.56621736", "0.55875385", "0.5548117", "0.552124", "0.5518552", "0.54944444", "0.5479289", "0.5467832", "0.54555374", "0.54480636", "0.54480636", "0.544...
0.5282989
31
Gets information about a proxied message by its message ID.
def msg_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProxyingApi.msg_id_get ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Miss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_details(message_id)\n @api.get(\"#{@api.path}/List/#{@id}/Email/#{message_id}\")\n end", "def get(message_id)\r\n messages.detect { |message| message.message_id.to_s == message_id.to_s }\r\n end", "def get_message\n @reply['message']\n end", "def message_id; @message_impl....
[ "0.63910395", "0.62182647", "0.61582416", "0.60901666", "0.5947086", "0.59081453", "0.5879912", "0.5849715", "0.5796156", "0.56621736", "0.55875385", "0.5548117", "0.552124", "0.5518552", "0.5479289", "0.5467832", "0.54555374", "0.54480636", "0.54480636", "0.5445527", "0.5439...
0.54944444
14
GET /api/v1/my_properties GET /api/v1/my_properties.json
def my_properties @api_v1_properties = current_api_v1_user.properties .includes(:reservations) .order('reservations.created_at DESC') render template: '/api/v1/properties/index', status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end", "def get_properties()...
[ "0.7624005", "0.7071321", "0.702465", "0.69350934", "0.68230826", "0.6815909", "0.68053883", "0.67712927", "0.67696095", "0.6728125", "0.67147994", "0.67144513", "0.66882455", "0.66697806", "0.66600853", "0.66600853", "0.66599804", "0.6648555", "0.66243917", "0.6623839", "0.6...
0.7296017
1
GET /api/v1/featured GET /api/v1/featured.json
def featured properties = [] begin # Try to get the 3 properties with priority flag Property.where(priority: true, status: :active).order('RANDOM()').limit(3).each { |p| properties << p } # Get the missing properties missing = 3 - properties.count Property.where(priority: false, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def featured\n request('featured')\n end", "def get_featured\n render json: Event.where(is_featured: true), status: :ok\n end", "def featured\n assets = Asset.featured.\n accessible_by_public.\n eager_load(user: :org).\n includes(:taggings).\n search_by_tags(par...
[ "0.8329511", "0.8071934", "0.72858673", "0.72249943", "0.7125574", "0.7043183", "0.7034604", "0.6988144", "0.69853663", "0.6908633", "0.6862562", "0.6790844", "0.6712276", "0.6692085", "0.6685624", "0.6685624", "0.6648502", "0.6598665", "0.6598665", "0.6476845", "0.6407719", ...
0.6158502
35
GET /check_availability GET /check_availability
def check_availability if @api_v1_property.is_available? params[:checkin_date].to_date, params[:checkout_date].to_date render json: { success: true }, status: 200 else render json: { success: false }, status: 200 end rescue Exception => errors render json: errors, status: :unprocessable_en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end", "def availability\n end", "def availability\n end", "def available?\n AvailableResponse.new(request(:get, '/information')).success?\n end", "def check_availability(opts)\n begin\n chec...
[ "0.8229653", "0.69625026", "0.6961534", "0.6911391", "0.6874071", "0.68182725", "0.67669636", "0.6605825", "0.6571128", "0.65585697", "0.65585697", "0.64076585", "0.63830626", "0.63745284", "0.6370969", "0.6359231", "0.63270813", "0.6301997", "0.63012236", "0.6286862", "0.627...
0.73539007
1
Use callbacks to share common setup or constraints between actions.
def set_api_v1_property @api_v1_property = Property.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def api_v1_property_params params.require(:api_v1_property).permit(:name, :description, :guest_max, :beds, :bedroom, :bathroom, :price, :accommodation_type, address_attributes: [:country, :state, :city, :neighborhood, :street, :number, :zipcode], facility_attributes: [:wifi, :towels, :clothes_iron, :refrigerator, :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
connexion: Roxe::Connexion token: String token_secret: String
def initialize(connexion:, token:, secret:) @connexion = connexion @token = token @secret = secret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_secret; end", "def token_secret; end", "def token_secret; end", "def token_secret; config[:token_secret]; end", "def connect!\n retrieve_auth_token unless connected?\n auth_token[:token]\n end", "def token_secret=(_arg0); end", "def token_secret=(_arg0); end", "def token_secret...
[ "0.6454385", "0.6454385", "0.6454385", "0.6327649", "0.61675996", "0.60916144", "0.60916144", "0.60916144", "0.59543365", "0.59533495", "0.58827317", "0.58586264", "0.58250445", "0.5790345", "0.5772821", "0.5708535", "0.56807953", "0.5679829", "0.5652773", "0.56435674", "0.56...
0.73249376
0
Pushes a scope onto the transaction stack this generates a TransactionSample::Segment at the end of transaction execution The generated segment will not be named until the corresponding pop_scope call is made. +tag+ should be a Symbol, and is only used for debugging purposes to identify this scope if the stack gets cor...
def push_scope(tag, time = Time.now.to_f, deduct_call_time_from_parent = true) stack = scope_stack transaction_sampler.notice_push_scope(time) if sampler_enabled? scope = ScopeStackElement.new(tag, time, deduct_call_time_from_parent) stack.push scope scope end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(new_scope = T.unsafe(nil)); end", "def notice_push_scope(time=Time.now)\n return unless builder\n\n segment = builder.trace_entry(time.to_f)\n @sample_buffers.each { |sample_buffer| sample_buffer.visit_segment(segment) }\n return segment\n end", "def scope_directive(t...
[ "0.55796957", "0.5379545", "0.5377539", "0.5243919", "0.5185735", "0.51584905", "0.5099671", "0.50978035", "0.50757504", "0.5061874", "0.50597864", "0.5011531", "0.5011531", "0.50015616", "0.49624532", "0.4939935", "0.47857052", "0.47810334", "0.476876", "0.476876", "0.476876...
0.6942184
0
Pops a scope off the transaction stack this updates the transaction sampler that we've finished execution of a traced method +expected_scope+ should be the ScopeStackElement that was returned by the corresponding push_scope call. +name+ is the name that will be applied to the generated transaction trace segment.
def pop_scope(expected_scope, name, time=Time.now.to_f) stack = scope_stack scope = stack.pop fail "unbalanced pop from blame stack, got #{scope ? scope.tag : 'nil'}, expected #{expected_scope ? expected_scope.tag : 'nil'}" if scope != expected_scope if !stack.empty? if scope....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_scope()\n @scopes.pop()\n end", "def notice_pop_scope(scope, time = Time.now)\n return unless builder\n raise \"finished already???\" if builder.sample.finished\n builder.trace_exit(scope, time.to_f)\n end", "def end(name)\n stack(name).pop\n end", "def end_t...
[ "0.6162461", "0.6160252", "0.6007148", "0.5777082", "0.57419103", "0.55337787", "0.54916334", "0.5469771", "0.5402997", "0.518351", "0.5146858", "0.5037573", "0.5006209", "0.4984742", "0.49807635", "0.494852", "0.48671818", "0.48112518", "0.4779861", "0.47613993", "0.4728221"...
0.8253548
0
deprecatedused to add transaction sampler, now we always look to the agent
def transaction_sampler= sampler NewRelic::Agent.logger.warn("NewRelic::Agent::StatsEngine#transaction_sampler is deprecated") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent; end", "def use_agent?; end", "def instrumenter; end", "def agent\n @agent\n end", "def current_transaction\n agent&.current_transaction\n end", "def agent\n @agent ||= Helpers.agent\n end", "def agent\n @agent\n end", "def agent\n @agent ||= initialize_ag...
[ "0.6372178", "0.61912894", "0.5841524", "0.576436", "0.5738553", "0.5701425", "0.5691459", "0.56426334", "0.562173", "0.5563184", "0.5563184", "0.55311316", "0.55059856", "0.5491888", "0.5487351", "0.54127866", "0.535798", "0.53420126", "0.5320302", "0.52296317", "0.5165952",...
0.76395667
0
Start a new transaction, unless one is already in progress
def start_transaction NewRelic::Agent.instance.events.notify(:start_transaction) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_transaction!\n fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction\n @in_transaction = true\n\n query 'BEGIN'\n end", "def start\n raise TransactionError, \"Transaction already opened.\" unless @id.nil?\n\n ensure_service!\n tx_res = service.begi...
[ "0.83332205", "0.7510673", "0.7242104", "0.69820297", "0.6981991", "0.6962463", "0.6953391", "0.69468707", "0.69323695", "0.6927324", "0.6927324", "0.68382007", "0.6829708", "0.68240535", "0.6820744", "0.6789522", "0.6763141", "0.67224574", "0.6679063", "0.6648197", "0.659530...
0.7005668
3
Try to clean up gracefully, otherwise we leave things hanging around on thread locals. If it looks like a transaction is still in progress, then maybe this is an inner transaction and is ignored.
def end_transaction stack = scope_stack if stack && stack.empty? NewRelic::Agent::TransactionState.get.clear_stats_scope_stack end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abort_transaction\n if @transaction_stack.empty?\n PEROBS.log.fatal 'No ongoing transaction to abort'\n end\n @transaction_stack.pop.each do |id|\n @transaction_objects[id]._restore(@transaction_stack.length)\n end\n @transaction_thread = nil\n end", "def teardown_cl...
[ "0.6931282", "0.6817526", "0.6768465", "0.6568108", "0.6370217", "0.6306321", "0.6272988", "0.62673", "0.6262869", "0.6258114", "0.6235986", "0.62141556", "0.6173606", "0.61584485", "0.6150136", "0.61378926", "0.6127306", "0.6079618", "0.6071461", "0.60603565", "0.6051177", ...
0.0
-1
Returns the current scope stack, memoized to a thread local variable
def scope_stack NewRelic::Agent::TransactionState.get.stats_scope_stack end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope_stack\n Threaded.scope_stack[object_id] ||= []\n end", "def stack(new_scope = T.unsafe(nil)); end", "def get_method_stack(fqns, name, scope: T.unsafe(nil)); end", "def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end", ...
[ "0.7215231", "0.6812647", "0.67261845", "0.65012753", "0.64723366", "0.63313633", "0.63313633", "0.63313633", "0.62532705", "0.62321264", "0.6163618", "0.61411226", "0.61352843", "0.6126527", "0.60567236", "0.60269743", "0.6002573", "0.5971819", "0.59584314", "0.59535384", "0...
0.6239695
9
enabled by rails integration so should only auto instrument if detected that it is being used without rails
def auto_instrument? !Contrib::Rails::Utils.railtie_supported? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_instrument?\n !Datadog::Contrib::Rails::Utils.railtie_supported?\n end", "def auto_instrument?\n true\n end", "def auto_instrument?\n false\n end", "def auto_instrument?\n false\n end", "def install_instrumentation\n _i...
[ "0.7251742", "0.7024581", "0.68869895", "0.68869895", "0.65413964", "0.6437431", "0.62892693", "0.61898845", "0.6177554", "0.61463726", "0.61463726", "0.61189663", "0.60933626", "0.60371065", "0.60371065", "0.59493583", "0.5851307", "0.57505596", "0.5701428", "0.5697629", "0....
0.75257915
1
Tells if the value is a power of 2.
def pow2? return self > 0 && (self & (self - 1) == 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_power_of_two?(num)\n if(Math::log(num, 2) % 1 != 0)\n return false \n end \n return true\nend", "def power_of_2?(a) Math.log2(a.to_i).then { |x| x == x.to_i } == true end", "def is_power_of_2(number)\n return false if number < 1\n\n # keep on shifting left until number equals one (power of 2) or...
[ "0.81630677", "0.8102928", "0.78901565", "0.78894585", "0.7827483", "0.7819919", "0.77953357", "0.7792739", "0.7750415", "0.764082", "0.7628686", "0.76162195", "0.76085806", "0.7588913", "0.7575403", "0.75554425", "0.7540068", "0.7503369", "0.7454946", "0.7442786", "0.7435297...
0.721846
24
Obtain information about a file Returns a SmartImage::Info object
def file_info(path) info File.read(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info_file\n @info_file ||= File.join(image_dir, '_info.txt')\n end", "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "def Fileinfo(path)\n Vidibus::Fileinfo::Base.new(path).data\nend", "def info_file\n @info_file ||= File.joi...
[ "0.73483753", "0.72560924", "0.7253772", "0.717407", "0.70936215", "0.6759373", "0.6734552", "0.670997", "0.6701729", "0.6622474", "0.6537645", "0.63984835", "0.63429385", "0.63326997", "0.6304424", "0.6282393", "0.6234446", "0.62154377", "0.6199731", "0.61383694", "0.6102550...
0.71841043
3
Generate a thumbnail from the given image data Options: width: max width of the image, or explicit width if not preserving aspect ratio height: ditto, except for height of course preserve_aspect_ratio: if true, ensure image fits within the given width/height restraints. format: file extension you'd ordinarily apply to ...
def thumbnail(data, options = {}) source_info = info data opts = { :width => source_info.width, :height => source_info.height, :preserve_aspect_ratio => true, :format => :png }.merge(options) width, height = calculate_aspect_ratio source_info, opts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image output_file, format, opts\n width = opts.fetch(:width, opts[:height]*1.5)\n\n if (opts[:crop])\n img_derivative = Vips::Image.thumbnail_buffer(source_file.content,\n 1000000, height: opts[:height], auto_rotate: true)\n # Centre is used for smartcrop due to an issue...
[ "0.68425375", "0.6473387", "0.64662015", "0.6394243", "0.63189", "0.62151754", "0.6172285", "0.6135189", "0.6108144", "0.6053832", "0.604718", "0.60427797", "0.60427797", "0.6033303", "0.60292226", "0.59708476", "0.5963655", "0.596157", "0.5957193", "0.5937471", "0.5936847", ...
0.76842046
0
Generate a thumbnail file from a given input file Accepts the same options as SmartImage.thumbnail
def thumbnail_file(input_path, output_path, options = {}) opts = { :format => File.extname(output_path).sub(/^\./, '') }.merge(options) data = SmartImage.thumbnail File.read(input_path), opts File.open(output_path, 'w') { |file| file << data } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_thumbnail path, img\n img = img.resize_to_fit 200,200\n img.write path\n end", "def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end", "def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.confi...
[ "0.771627", "0.7493153", "0.747031", "0.74280715", "0.7386362", "0.73450947", "0.7309704", "0.726219", "0.70519656", "0.7026214", "0.7022068", "0.7017284", "0.69373137", "0.6900627", "0.68806154", "0.6870913", "0.6854773", "0.68343663", "0.6784637", "0.6772431", "0.6750434", ...
0.83215475
0
Solve aspect ratio constraints based on source image info and a given options hash. This is mostly an internal method but if you find it useful knock yourself out.
def calculate_aspect_ratio(info, options) if options[:preserve_aspect_ratio] composited_size = SmartImage::RatioCalculator.new( :source_width => info.width, :source_height => info.height, :dest_width => Integer(options[:width]), :dest_height => Integer(options[:h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wp_image_matches_ratio(source_width, source_height, target_width, target_height)\n # To test for varying crops, we constrain the dimensions of the larger image\n # to the dimensions of the smaller image and see if they match.\n if source_width > target_width\n constrained_size = wp_constrain_dime...
[ "0.5962969", "0.57358533", "0.57189864", "0.5668326", "0.55211025", "0.549524", "0.5477152", "0.5458478", "0.5429798", "0.54281306", "0.53978384", "0.5391034", "0.5346928", "0.53164953", "0.53101754", "0.52925766", "0.5285861", "0.52722794", "0.5261917", "0.5255572", "0.52555...
0.71334213
0
Create a new SmartImage of the given width and height. Always takes a block... no exceptions! Returns a destroyed SmartImage object. SmartImage.new(400, 300) do |compositor| compositor.image "foo/bar.jpg", :x => 10, :y => 10 compositor.text "Hello, world!", :x => 20, :y => 20 compositor.write "baz/qux.jpg" end When use...
def initialize(width, height, &block) raise ArgumentError, "give me a block, pretty please" unless block_given? @width, @height = Integer(width), Integer(height) @canvas = SmartImage::Canvas.new @width, @height yield self @canvas.destroy @canvas = DeadCanvas.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_new(width, height)\n Magick::Image.new(width, height)\n end", "def C(*args)\n @image = Image.new(@image.cols, @image.rows) if @image\n end", "def new_image(cols, rows, *fill, &info_blk)\n self << Magick::Image.new(cols, rows, *fill, &info_blk)\n end", "def write_image(&block...
[ "0.6253485", "0.59670156", "0.56882024", "0.5675352", "0.54641235", "0.54434663", "0.5411686", "0.5405588", "0.5332413", "0.52732915", "0.52424437", "0.5240307", "0.52192634", "0.5204882", "0.5204882", "0.5204836", "0.5198307", "0.5169201", "0.5147979", "0.5143162", "0.513502...
0.77119756
0
Composite the given image data onto the SmartImage Accepts the following options: x: coordinate of the upper left corner of the image (default 0) y: ditto, it's the y coordinate width: an alternate width height: alternate height preserve_aspect_ratio: should the aspect ratio be preserved? (default: true)
def composite(data, options = {}) info = self.class.info data opts = { :x => 0, :y => 0, :width => info.width, :height => info.height, :preserve_aspect_ratio => true }.merge(options) dest_width, dest_height = self.class.calculate_aspect_ratio info, opts @can...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose(image, xpos, ypos)\n Ext.pkl_composite(@pkl_image, image.rawdata, xpos, ypos)\n self\n end", "def thumbnail(data, options = {})\n source_info = info data\n \n opts = {\n :width => source_info.width,\n :height => source_info.height,\n :preserve_aspect_...
[ "0.61983454", "0.61143506", "0.5895754", "0.54752177", "0.54461074", "0.5443", "0.53696746", "0.5330451", "0.5301764", "0.52966994", "0.52966994", "0.52768594", "0.5225115", "0.5223957", "0.51734585", "0.5140588", "0.5094359", "0.50792944", "0.50318974", "0.5016155", "0.50082...
0.7485379
0
Composite a given image file onto the SmartImage. Accepts the same options as the composite method
def composite_file(file, options = {}) composite File.read(file), options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose(image, xpos, ypos)\n Ext.pkl_composite(@pkl_image, image.rawdata, xpos, ypos)\n self\n end", "def make\n Paperclip.log(\"*********** Product is custom! Compositing...\")\n nameImg = createText(productName, \"36\", \"\")\n\n # next create the description text image\n ...
[ "0.6124523", "0.6011414", "0.5965777", "0.5926221", "0.5842004", "0.5837974", "0.57651293", "0.5682751", "0.56001526", "0.55773836", "0.55119616", "0.54648465", "0.543127", "0.54260063", "0.5385054", "0.53793967", "0.53692305", "0.53537184", "0.5310484", "0.5298171", "0.52879...
0.6602236
0
Apply an alpha mask from the given image data. Doesn't accept any options right now, sorry. It's just another useless dangling options hash.
def alpha_mask(data, options = {}) @canvas.alpha_mask data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_mask_file(file, options = {})\n alpha_mask File.read(file), options\n end", "def decompose_alpha_components(color, mask, bg)\n [\n decompose_alpha_component(:r, color, mask, bg),\n decompose_alpha_component(:g, color, mask, bg),\n decompose_alpha_component(:b, color, mask,...
[ "0.6569973", "0.56079084", "0.55862594", "0.5484082", "0.521127", "0.51889336", "0.51889336", "0.51544464", "0.51442975", "0.51379806", "0.51296806", "0.50637347", "0.50634205", "0.5061359", "0.5028474", "0.5020763", "0.5010563", "0.49640617", "0.49619043", "0.49535808", "0.4...
0.8272222
0
Apply an alpha mask from the given file. Accepts the same options as the alpha_mask method.
def alpha_mask_file(file, options = {}) alpha_mask File.read(file), options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_mask(data, options = {})\n @canvas.alpha_mask data\n end", "def operation(*args)\n src_file, out_file = args\n image = Vips::Image.new_from_file(src_file).add_alpha\n watermark = Vips::Image.new_from_file options[:image]\n image.composite2(watermark,\n ...
[ "0.6808334", "0.5451855", "0.5219435", "0.49257156", "0.48692897", "0.47423938", "0.47352389", "0.46842548", "0.4653055", "0.45878273", "0.4569271", "0.45672214", "0.45572993", "0.45074275", "0.4494521", "0.4494521", "0.44683328", "0.4451213", "0.44185913", "0.43517634", "0.4...
0.8958062
0
Encode the image with the given format (a file extension) and return it as a string. Doesn't accept any options at present. The options hash is just there to annoy you and make you wish it had more options.
def encode(format, options = {}) # Sorry .jpeg lovers, I'm one of you too but the standard is jpg format = 'jpg' if format.to_s == 'jpeg' format = format.to_s raise ArgumentError, "invalid format: #{format}" unless %w(jpg png gif).include?(format) @canvas.encode format, options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoded_image(image, options = {})\n target_format = options[:format] || default_render_format\n\n unless target_format.in?(Alchemy::Picture.allowed_filetypes)\n raise WrongImageFormatError.new(self, target_format)\n end\n\n options = {\n flatten: target_format != \"gif\" && i...
[ "0.72640944", "0.7061968", "0.6375061", "0.62814397", "0.62467766", "0.6242489", "0.6205856", "0.61302286", "0.61201876", "0.586622", "0.586622", "0.58560646", "0.5829241", "0.5733593", "0.5719053", "0.5694132", "0.56884646", "0.5664008", "0.5643319", "0.56289047", "0.5596423...
0.7841114
0
Write the resulting image out to disk. Picks format based on filename. Takes the same options as encode
def write(path, options = {}) format = File.extname(path).sub(/^\./, '') File.open(path, 'w') { |file| file << encode(format, options) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_impl(format, file)\n ImageIO.write(@src, format, file)\n end", "def encode_file(filename, format, options = T.unsafe(nil)); end", "def save_impl(format, file)\n write_new_image format, FileImageOutputStream.new(file)\n end", "def process\n format = directives.fetch(:format, 'jpg')\n...
[ "0.728827", "0.7250475", "0.71650153", "0.65987074", "0.642471", "0.64110684", "0.64078975", "0.63231325", "0.6272153", "0.6235236", "0.61283463", "0.61229575", "0.6106695", "0.6106695", "0.6100173", "0.60841703", "0.6048273", "0.6035325", "0.6028773", "0.6012713", "0.6003148...
0.6011897
20
return phi(n) / n
def phi_norm(n) primes = n.prime_division.map(&:first) primes.map { |p| 1.0 - 1.0 / p }.inject(:*) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phi(n)\n factor(n).map { |p, e| (p - 1) * (p**(e - 1)) }.inject(:*) || 0\n end", "def phi(n)\n return n - 1 if Prime.prime?(n)\n (0...n).reduce(0) do |tots_count, i|\n co_prime?(n, i) ? tots_count + 1 : tots_count\n end\n end", "def totient_phi(n)\n n == 1 ? 1 : (1...n).select {|v| ...
[ "0.866304", "0.7891755", "0.76125264", "0.7596528", "0.7273465", "0.72019327", "0.71421313", "0.70983684", "0.695647", "0.69000095", "0.68165743", "0.6763466", "0.6680367", "0.6660973", "0.6556402", "0.6537911", "0.64941627", "0.6472381", "0.6400932", "0.63555056", "0.634435"...
0.81001025
1
No longer using Box, write to disk (/tmp) instead: HELIO4066
def send_reports(type, reports) dir = File.join("/tmp", type, "#{@start_date.strftime("%Y-%m")}_to_#{@end_date.strftime("%Y-%m")}") FileUtils.mkdir_p dir reports.each do |name, report| file = File.join(dir, name) File.write(file, CounterReporterService.csv(report)) Rails.logger...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tmp &block\n tmp_dir = \"/tmp/vfs_#{rand(10**3)}\" \n if block\n begin\n create_dir tmp_dir\n block.call tmp_dir\n ensure\n delete_dir tmp_dir\n end\n else\n create_dir tmp_dir\n tmp_dir\n end\n ...
[ "0.6209948", "0.6029439", "0.5941401", "0.5884554", "0.582307", "0.575796", "0.5749387", "0.5724311", "0.56624836", "0.5658367", "0.5658367", "0.5658367", "0.5644396", "0.5644396", "0.5625201", "0.56189406", "0.56128985", "0.5610545", "0.55887496", "0.5587289", "0.5546881", ...
0.0
-1
Write a method that takes a nonempty string argument, and returns the middle character or characters of the argument. If the argument has an odd length, you should return exactly one character. If the argument has an even length, you should return exactly two characters.
def center_of(str) middle = (str.length/2) if str.length.odd? str[middle] else str[(middle-1)..middle] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_substring(str)\n length = str.length\n if length.odd?\n str[length/2]\n else\n str[length/2-1,2]\n end\nend", "def middle_character(string)\n array = string.split('')\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n array.slice(middle_index)\n else\n array.slice((mi...
[ "0.78895944", "0.78602266", "0.7764119", "0.77538663", "0.77177954", "0.7684336", "0.7665085", "0.76648396", "0.7654366", "0.76537836", "0.7637909", "0.75207573", "0.75198376", "0.7494196", "0.7490748", "0.74778676", "0.747434", "0.7434705", "0.7325687", "0.72921485", "0.7239...
0.7149592
29
Checking if fetching must be done
def perform? !song.synced? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def need_to_fetch?\n @need_to_fetch = true if @need_to_fetch.nil?\n @need_to_fetch\n end", "def fetch\n if fetcher.fetch_required?\n fetcher.fetch\n true\n else\n false\n end\n end", "def should_fetch?\n last_fetched_at.nil? or !fetched_directly? or facebo...
[ "0.7741135", "0.7695419", "0.7610573", "0.7359146", "0.73538786", "0.7280915", "0.72661334", "0.7196646", "0.7072098", "0.7042714", "0.6994313", "0.68941945", "0.67224765", "0.6706665", "0.66793704", "0.65676415", "0.6556252", "0.6448407", "0.63819677", "0.62998307", "0.62836...
0.0
-1
Adds aggregated behavior to a model.
def acts_as_aggregated(options = {}) options.symbolize_keys! options.assert_valid_keys(:cache_by, :non_content_columns) include AggregatedBehavior if options[:cache_by].present? @aggregated_caching_column = options[:cache_by] include AggregatedCacheBehavior end if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_aggregate_model(model, *keys)\n # {{{\n add_foreign_key_to(model, *keys)\n @aggregate_klasses[model.table_name] = [ model, *keys ]\n @aggregates_tree[model.table_name] = model.__associations__.aggregates_tree\n # Required attributes of aggregated models are not \n # required i...
[ "0.64286244", "0.58057934", "0.5288934", "0.5286722", "0.52084726", "0.520477", "0.5040417", "0.5000486", "0.4933621", "0.48838657", "0.48681414", "0.48631245", "0.48609325", "0.48435915", "0.47351193", "0.4725684", "0.47234923", "0.47214675", "0.46899754", "0.46797615", "0.4...
0.60036016
1
Adds tracked behavior to a model
def acts_as_tracked(options = {}) options.symbolize_keys! options.assert_valid_keys(:preceding_key, :by) include TrackedBehavior @preceding_key_column = options[:preceding_key] @parent_relation_keys = get_parent_relation_keys(options[:by]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acts_as_tracked?\n self < TrackedBehavior\n end", "def track(model)\n @queue << model.name\n end", "def add_model_to_list(m)\n tn = implementation_model_name\n self.class.models[tn] = m\n logger.info \"Added new model #{tn}\"\n self.class.model_names << tn unless sel...
[ "0.6040155", "0.5626592", "0.5606573", "0.5595309", "0.5575218", "0.5482108", "0.5432661", "0.5430642", "0.5430642", "0.54253614", "0.528598", "0.52694714", "0.52080154", "0.5207346", "0.51633793", "0.51585066", "0.5152662", "0.5116264", "0.50993824", "0.50958693", "0.5072022...
0.5180098
14
Return +true+ if self was declared as +acts_as_aggregated+.
def acts_as_aggregated? self < AggregatedBehavior end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregating?\n !!@aggregating\n end", "def aggregates?(name)\n aggregated_associations.include?(name.to_sym)\n end", "def updated_as_aggregated?\n !!@updated_as_aggregated\n end", "def is_aggregate\n\t if read_attribute(:is_aggregate) == 0 then\n\t false\n\t else\n\t t...
[ "0.72357196", "0.70536375", "0.6945088", "0.6842745", "0.6473308", "0.62787163", "0.6239684", "0.5931639", "0.58801943", "0.5838319", "0.5669201", "0.5646711", "0.5590053", "0.54295164", "0.54012", "0.5390795", "0.5390795", "0.53700006", "0.53268427", "0.53268427", "0.5317033...
0.8416229
0