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
POST /venue_products POST /venue_products.json
def create @venue_product = VenueProduct.new(params[:venue_product]) @venue = Venue.find_by_fs_venue_id(@venue_product.fs_venue_id) @venue.product_count=(@venue.product_count).to_i + 1 #@venue.update_attribute(:product_count,(@venue.product_count).to_i + 1) respond_to do |format| if @venue_product.save && @venue.save format.html { redirect_to @venue_product, notice: 'Venue product was successfully created.' } format.json { render json: @venue_product, status: :created, location: @venue_product } else format.html { render action: "new" } format.json { render json: @venue_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = current_vendor.vendor_pro...
[ "0.7162615", "0.7000326", "0.69932795", "0.6844026", "0.6829674", "0.68229145", "0.6794237", "0.6784045", "0.67747784", "0.67253536", "0.6683777", "0.666079", "0.6660258", "0.6631464", "0.65690976", "0.6559447", "0.6538372", "0.652779", "0.6522539", "0.65179026", "0.6479962",...
0.6689047
10
PUT /venue_products/1 PUT /venue_products/1.json
def update @venue_product = VenueProduct.find(params[:id]) respond_to do |format| if @venue_product.update_attributes(params[:venue_product]) format.html { redirect_to @venue_product, notice: 'Venue product was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @venue_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def create\n @venue_product = VenueProduct.new(params[:venue_product])\n @venue = Venue.find_by_fs_venue_...
[ "0.7166039", "0.70487285", "0.6803697", "0.6775359", "0.6721408", "0.66535074", "0.65982443", "0.65561634", "0.6468863", "0.64300823", "0.6405758", "0.6347122", "0.6334088", "0.63302326", "0.62840956", "0.6268829", "0.6233896", "0.6210458", "0.6177357", "0.6169723", "0.615473...
0.7164332
1
DELETE /venue_products/1 DELETE /venue_products/1.json
def destroy @venue_product = VenueProduct.find(params[:id]) @venue_product.destroy @venue = Venue.find_by_fs_venue_id(@venue_product.fs_venue_id) @venue.update_attribute(:product_count,(@venue.product_count).to_i - 1) respond_to do |format| format.html { redirect_to venue_products_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end", "def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n ...
[ "0.7410696", "0.7306608", "0.72702295", "0.72172797", "0.71904117", "0.71089923", "0.709993", "0.70936406", "0.7086999", "0.7046182", "0.7044976", "0.7018566", "0.7004353", "0.7001813", "0.6991188", "0.699093", "0.699093", "0.699093", "0.699093", "0.699093", "0.699093", "0....
0.73826516
1
input 1,2 and then returns array
def assign_move move = gets.chomp assign_move unless valid_input?(move) move.split(',').map(&:to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_array(one, two, three)\n\treturn [one, two, three]\nend", "def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend", "def return_array(array1, array2)\nfor num in array2\n i...
[ "0.6579444", "0.6547201", "0.6281557", "0.6135942", "0.6132275", "0.61030716", "0.6090717", "0.6062853", "0.6001048", "0.5987987", "0.59759295", "0.5956772", "0.5941902", "0.59374934", "0.59264755", "0.59157026", "0.589297", "0.586374", "0.586374", "0.58619434", "0.5849862", ...
0.0
-1
args << " if args.empty?
def parse_json(json) case json["type"] when "track" { title: json["name"], artist: json["artists"].map { |i| i["name"] }.join(", "), album: json["album"]["name"], thumbnail: json["album"]["images"].sort_by { |i| i["height"] }.last["url"], length: json["duration_ms"].to_i / 1000.0, preview_url: json["preview_url"], } when "album" { } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_args(args)\n args.empty? || args.last.blank? ? nil : args\n end", "def add_empty_arg_if_ends_in_option(args, option)\n de_option(args.last) == option.long ? args + [\"\"] : args\n end", "def is_command_line_arg_empty(arg)\n arg.nil? or arg.empty?\nend", "def not _args\n ...
[ "0.7281519", "0.7248637", "0.6822138", "0.6371708", "0.6279414", "0.625189", "0.6053999", "0.6009087", "0.59904957", "0.59859973", "0.59656316", "0.59419245", "0.5936906", "0.5927096", "0.5880387", "0.5880387", "0.5847994", "0.58446515", "0.58446515", "0.5841122", "0.5826194"...
0.0
-1
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength
def initialize(hash = {}) @timestamp = hash['L_TIMESTAMP'] || nil @timezone = hash['L_TIMEZONE'] || nil @type = hash['L_TYPE'] || nil @email = hash['L_EMAIL'] || nil @name = hash['L_NAME'] || nil @transaction_id = hash['L_TRANSACTIONID'] || nil @status = hash['L_STATUS'] || nil @amount = (hash['L_AMT'] || nil).to_f @currency_code = hash['L_CURRENCYCODE'] || nil @fee_amount = (hash['L_FEEAMT'] || nil).to_f @net_amount = (hash['L_NETAMT'] || nil).to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def strategy; end", "def refutal()\n end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def used?; end", "def offences_by; end", "def inten...
[ "0.73630476", "0.615412", "0.615412", "0.6032553", "0.5965464", "0.5951271", "0.58832294", "0.58139944", "0.58139944", "0.58139944", "0.58139944", "0.5730861", "0.5728308", "0.5709761", "0.563326", "0.5627984", "0.5627984", "0.5620393", "0.5620393", "0.5603432", "0.55856967",...
0.0
-1
ids = ["928", "136094", "1488", "144722", "926", "937", "765", "791", "834", "111114", "8162", "723", "7662", "900", "1312", "608", "136166", "244856", "1464", "758", "9522", "761", "1361", "140731", "140425", "8234", "918", "9920", "771", "555", "839", "553", "939", "136718", "110810", "1456", "1338", "604", "943", "10422", "781", "11077", "576", "11098", "830", "814", "539", "113646", "113645", "1305", "787", "1470", "925", "38171", "9726", "733", "924", "875", "1521", "695", "1436", "930", "310277", "8240", "681", "1326", "622", "6831", "144721", "922", "662", "856", "642", "646", "641", "1400", "541", "889", "890", "914", "832", "1046", "852", "849", "145135", "8049", "584", "15228", "862", "12351", "739", "1027", "845", "1145", "942", "597", "657", "803", "554", "8096", "760", "35448", "867", "7630", "258392", "258079", "904", "1401", "883", "666", "1358", "116389", "915", "1462", "1041", "8108", "1285", "12350", "836", "110998", "12935", "1489", "871", "1402", "821", "1137", "1261", "1364", "549", "1522", "112294", "12330", "8238", "7629", "15267", "1347", "1373", "697", "1472", "879", "1444", "1403", "1342", "12928", "1262", "866", "1390", "935", "1397", "1058", "12936", "8128", "1315", "1336", "138763", "245296", "313766", "1457", "1365", "113700", "1136", "1299", "133598", "241377", "593", "1307", "6707", "12843", "6700", "6827", "838", "940", "865", "1478", "831", "712", "1313", "899", "108653", "7608", "575", "948", "143336", "552", "301568", "324992", "138292", "135448", "805", "256871", "9072", "8171", "561", "306425", "802", "8041", "811", "590", "736", "827", "7665", "1139", "807", "9336", "682", "143586", "9910", "136096", "313767", "7654", "1070", "709", "9921", "571", "692", "1468", "312902", "700", "38169", "870", "780", "826", "850", "655", "15466", "631", "672", "851", "880", "1329", "15107", "330306", "896", "1475", "1349", "1408", "713", "1407", "1409", "1303", "1284", "727", "822", "192074", "140300", "749", "8046", "595", "8239", "1272", "15045", "8047", "15053", "15052", "929", "15064", "15054", "645", "15192", "8097", "1114", "1138", "7689", "9335", "12346", "1113", "7996", "842", "304250", "12937", "1513", "654", "7988", "140224", "38172", "15123", "38168", "38167", "573", "38170", "15055", "1465", "9887", "8230", "7598", "7625", "20398", "8109", "20448", "8024", "252638", "8026", "8028", "945", "8209", "548", "20315", "675", "8396", "8093", "11442", "818", "877", "8204", "627", "7590", "1043", "7589", "558", "8048", "789", "847", "634", "8100", "906", "8236", "623", "8101", "527", "8180", "792", "8331", "1467", "9073", "9311", "112252", "7990", "35442", "1528", "7817", "7833", "1035", "8200", "7672", "134718", "9310", "35632", "1304", "12708", "15195", "1066", "9926", "8061", "664", "252741", "810", "683", "1317", "35429", "113250", "35612", "1518", "1421", "12938", "12127", "113115", "12137", "788", "874", "7583", "7986", "579", "1068", "12930", "578", "1511", "144617", "572", "605", "1316", "12445", "1318", "9917", "311978", "9913", "7671", "34126", "891", "1348", "1302", "12130", "919", "1289", "820", "146004", "8398", "801", "1368", "113695", "611", "1350", "663", "748", "745", "882", "594", "947", "108665", "859", "112007", "1512", "110330", "884", "248780", "1051", "1410", "864", "1362", "1450", "680", "1466", "872", "869", "1294", "763", "8066", "8112", "12908", "12126", "772", "113640", "8067", "643", "648", "7643", "835", "587", "15199", "644", "603", "7617", "860", "671", "7618", "670", "912", "7995", "305319", "7882", "1319", "944", "7597", "113647", "1463", "8912", "7638", "598", "8133", "613", "136958", "7639", "35556", "7562", "737", "24254", "574", "7569", "7696", "140223", "8228", "14872", "111977", "35437", "7678", "22024", "9591", "12858", "12929", "7721", "8118", "15113", "7683", "7585", "7564", "35644", "15049", "7682", "8175", "22023", "35493", "7593", "7727", "8911", "35424", "35445", "12859", "9319", "9262", "8392", "8034", "632", "710", "854", "109325", "141982", "649", "888", "525", "220364", "828", "562", "908", "911", "913", "336341", "711", "819", "577", "596", "690", "898", "635", "265216", "812", "777", "133580", "887", "588", "551", "1487", "1371", "691", "7642", "936", "1069", "8129", "741", "1405", "591", "767", "714", "796", "910", "253268", "1089", "774", "782", "582", "735", "886", "335657", "799", "853", "797", "1270", "693", "1435", "112575", "638", "823", "303448", "934", "923", "679", "873", "8035", "674", "905", "660", "1271", "878", "323345", "628", "800", "1333", "144484", "563", "916", "12934", "793", "12549", "806", "653", "894", "895", "556", "798", "917", "267599", "892", "217373", "1533", "846", "813", "317722", "535", "1036", "794", "920", "844", "696", "217374", "1047", "1034", "931", "265193", "1301", "927", "876", "135093", "652", "858", "265346", "266546", "647", "658", "1086", "633", "656", "885", "335970", "843", "734", "868", "560", "1091", "258077", "1062", "960", "112253", "665", "848", "704", "113249", "708", "536", "1534", "938", "142049", "897", "689", "109413", "933", "135434", "946", "699", "694", "857", "840", "804", "907", "863", "610", "614", "903", "687", "108697", "335959", "740", "305049", "901", "136125", "881", "1044", "941", "244447", "841", "744", "909", "1090", "8051", "7976", "12379", "15465", "540", "705", "1320", "816", "1049", "742", "743", "817", "1360", "1451", "1030", "636", "1359", "659", "855", "661", "113424", "724", "308596", "784", "621", "755", "990", "235718", "861", "1179", "9312", "9337", "8207", "8167", "35453", "7609", "8019", "8010", "1147", 1088 ]
def save_and_annotate!(id) initial_path = "#{INITIAL_DIRECTORY}/#{id}.jpg" annotated_path = "#{ANNOTATED_DIRECTORY}/#{id}" info = @scraper.load_info(id) image = @scraper.download_image(id) @scraper.save_image(image, initial_path) @annotater.annotate(initial_path, info).write(annotated_path) rescue Exception => e; puts e # Don't Care end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p13\n\tnumbers = [\n\t\t37107287533902102798797998220837590246510135740250,\n\t\t46376937677490009712648124896970078050417018260538,\n\t\t74324986199524741059474233309513058123726617309629,\n\t\t91942213363574161572522430563301811072406154908250,\n\t\t23067588207539346171171980310421047513778063246676,\n\t\t89...
[ "0.6737016", "0.63833815", "0.58200455", "0.5559386", "0.55511963", "0.55015606", "0.5407118", "0.53740865", "0.5333963", "0.5266496", "0.52049565", "0.5198063", "0.5194428", "0.5192914", "0.5192491", "0.51397467", "0.5131074", "0.5120081", "0.5119804", "0.5112675", "0.511161...
0.0
-1
GET /class_mstrs/1 GET /class_mstrs/1.json
def show @class_mstr = ClassMstr.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @class_mstr } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def create\n @class_mstr = ClassMstr.new(params[:class_mstr])\n\n respond_to do |format|\n if @class_mstr.save\n format.htm...
[ "0.6766376", "0.6220849", "0.6136893", "0.57798994", "0.5594178", "0.5497495", "0.5411029", "0.53584445", "0.53566587", "0.5325192", "0.5323454", "0.5296612", "0.52880615", "0.5262098", "0.5259857", "0.5237473", "0.520919", "0.518276", "0.5181694", "0.5165975", "0.51525146", ...
0.74215513
0
GET /class_mstrs/new GET /class_mstrs/new.json
def new @class_mstr = ClassMstr.new respond_to do |format| format.html # new.html.erb format.json { render json: @class_mstr } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @class_mstr = ClassMstr.new(params[:class_mstr])\n\n respond_to do |format|\n if @class_mstr.save\n format.html { redirect_to @class_mstr, notice: 'Class mstr was successfully created.' }\n format.json { render json: @class_mstr, status: :created, location: @class_mstr }\n ...
[ "0.73339677", "0.6836156", "0.6742399", "0.6738194", "0.6734112", "0.66999346", "0.66479534", "0.6599336", "0.65674067", "0.6533665", "0.64841795", "0.6473684", "0.6430053", "0.64299434", "0.64298135", "0.64269", "0.64241457", "0.64189464", "0.6397075", "0.63805115", "0.63781...
0.8153798
0
POST /class_mstrs POST /class_mstrs.json
def create @class_mstr = ClassMstr.new(params[:class_mstr]) respond_to do |format| if @class_mstr.save format.html { redirect_to @class_mstr, notice: 'Class mstr was successfully created.' } format.json { render json: @class_mstr, status: :created, location: @class_mstr } else format.html { render action: "new" } format.json { render json: @class_mstr.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def update\n @class_mstr = ClassMstr.find(params[:id])\n\n respond_to do |format|\n if @class_mstr.update_attributes(params[:class...
[ "0.65978897", "0.5741829", "0.5736589", "0.56870127", "0.55405754", "0.54426616", "0.53879553", "0.53110605", "0.52808344", "0.5262188", "0.5228495", "0.52097076", "0.5171778", "0.5115983", "0.50619906", "0.5047747", "0.50452596", "0.50334734", "0.50328296", "0.5022774", "0.5...
0.74123466
0
PUT /class_mstrs/1 PUT /class_mstrs/1.json
def update @class_mstr = ClassMstr.find(params[:id]) respond_to do |format| if @class_mstr.update_attributes(params[:class_mstr]) format.html { redirect_to @class_mstr, notice: 'Class mstr was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @class_mstr.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @class_mstr = ClassMstr.new(params[:class_mstr])\n\n respond_to do |format|\n if @class_mstr.save\n format.html { redirect_to @class_mstr, notice: 'Class mstr was successfully created.' }\n format.json { render json: @class_mstr, status: :created, location: @class_mstr }\n ...
[ "0.6341769", "0.59903437", "0.5927272", "0.583068", "0.5781234", "0.5694129", "0.5645306", "0.55119747", "0.5507019", "0.55057716", "0.54600924", "0.5445111", "0.5440505", "0.5432048", "0.54282683", "0.5306748", "0.52981883", "0.52841765", "0.5282905", "0.5274818", "0.5228124...
0.7273992
0
DELETE /class_mstrs/1 DELETE /class_mstrs/1.json
def destroy @class_mstr = ClassMstr.find(params[:id]) @class_mstr.destroy respond_to do |format| format.html { redirect_to class_mstrs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n respond_to do |format|\n format.html { redirect_to clclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @s_class.destroy\n respond_to do |format|\n format.html { redirect_to s_cl...
[ "0.6695708", "0.66694635", "0.66257393", "0.6602856", "0.6503053", "0.649038", "0.6460784", "0.64586323", "0.6439553", "0.6428524", "0.6426718", "0.6402536", "0.63996416", "0.63938695", "0.63475513", "0.6335546", "0.6328293", "0.63274884", "0.6316141", "0.63152456", "0.624975...
0.7703819
0
GET /videos GET /videos.json
def index @videos = current_user.videos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n e...
[ "0.8300022", "0.7734552", "0.77048963", "0.75849354", "0.74897736", "0.74893093", "0.74893093", "0.74893093", "0.74893093", "0.74756104", "0.73633087", "0.7358063", "0.7357167", "0.730496", "0.72600365", "0.7200847", "0.7194637", "0.71250415", "0.71250415", "0.71250415", "0.7...
0.69204074
32
GET /videos/1 GET /videos/1.json
def show @video = Video.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n e...
[ "0.77855194", "0.7450134", "0.7386234", "0.73798877", "0.73798877", "0.73798877", "0.73798877", "0.73798877", "0.73798877", "0.73798877", "0.73703194", "0.7363398", "0.73398286", "0.7338815", "0.7338815", "0.7338815", "0.7338815", "0.7308188", "0.722379", "0.72142017", "0.720...
0.69005495
50
POST /videos POST /videos.json
def create @video = current_user.videos.new(video_params) respond_to do |format| if @video.save format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' } format.json { render :index, status: :created, location: @video } else format.html { redirect_to new_video_path(), notice: 'Video não salvo.' } format.json { render json: @video.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end", "def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }...
[ "0.7559166", "0.72561485", "0.72147936", "0.72094315", "0.70647645", "0.70605457", "0.70605457", "0.70605457", "0.70605457", "0.69911706", "0.69875956", "0.69875956", "0.69875956", "0.69875956", "0.69875956", "0.69389236", "0.69220686", "0.69220686", "0.6870992", "0.68684244", ...
0.7070432
4
PATCH/PUT /videos/1 PATCH/PUT /videos/1.json
def update respond_to do |format| if @video.update(video_params) format.html { redirect_to videos_path(), notice: 'Video atualizado com sucesso.' } format.json { render :index, status: :ok, location: @video } else format.html { redirect_to edit_video_path(@video), alert: 'Video não atualizado' } format.json { render json: @video.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @video.update(video_params)\n render json: @video\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.j...
[ "0.7237686", "0.68665653", "0.68665653", "0.68647146", "0.68624663", "0.68624663", "0.68624663", "0.68624663", "0.68624663", "0.68624663", "0.68624663", "0.6819483", "0.6819483", "0.6819483", "0.6819483", "0.6819483", "0.67994", "0.67747194", "0.67690694", "0.672215", "0.6719...
0.65009505
47
DELETE /videos/1 DELETE /videos/1.json
def destroy @video.destroy respond_to do |format| format.html { redirect_to videos_url, notice: 'Video excluido com sucesso.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.ht...
[ "0.7782917", "0.7782917", "0.7768144", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.77617705", "0.7723812", "0.77067566", "0.7692495", "0.7692495", "0.7692495", "0....
0.74875367
33
Use callbacks to share common setup or constraints between actions.
def set_video if current_user.present? @video = current_user.videos.where(id: params[:id]).includes(:video_views).first if @video.nil? respond_to do |format| format.html { redirect_to videos_path(), notice: 'Você não tem permissão para acessar esse vídeo.' } end end else @video = Video.find(params[:id]) end 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 list of trusted parameters through.
def video_params return if params[:video].nil? params.require(:video).permit(:name, :url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Replaces the CORS rules attached to this bucket. You can pass one or more rules as an array or a list. replace all exisitng rules with a single rule bucket.cors.set( :allowed_methods => %w(GET), :allowed_origins => %w( :max_age_seconds => 3600) If you pass an empty array, all of the rules will be removed from the bucket. these two lines are equivilent bucket.cors.clear bucket.cors.set([])
def set *rules raise ArgumentError, 'expected one or more rules' if rules.empty? if rules == [[]] self.clear else rules = rule_hashes(rules) client.put_bucket_cors(:bucket_name => bucket.name, :rules => rules) end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cors(allowed_methods, allowed_origins)\n @bucket_cors.put(\n cors_configuration: {\n cors_rules: [\n {\n allowed_methods: allowed_methods,\n allowed_origins: allowed_origins,\n allowed_headers: %w[*],\n max_age_seconds: 3600\n }\n...
[ "0.70802253", "0.6572307", "0.6097518", "0.60075957", "0.60075957", "0.60075957", "0.6005232", "0.6005232", "0.59778595", "0.58880824", "0.5879022", "0.5877326", "0.5834417", "0.5806228", "0.57988816", "0.5797561", "0.5780403", "0.5775429", "0.5775429", "0.5775429", "0.577542...
0.8100972
0
Add one or more CORS rules to this bucket. adding a single rule as a hash bucket.cors.add( :allowed_methods => %w(GET HEAD), :allowed_origins => %w(), :max_age_seconds => 3600) You can add multiple rules in a single call: each rule may be a hash, CORSRule or a CORSRuleCollection, bucket.cors.add(rules) alternatively you can pass a list of rules bucket.cors.add(rule1, rule2, ...)
def add *rules self.set(self, *rules) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set *rules\n\n raise ArgumentError, 'expected one or more rules' if rules.empty?\n\n if rules == [[]]\n self.clear\n else\n rules = rule_hashes(rules)\n client.put_bucket_cors(:bucket_name => bucket.name, :rules => rules)\n end\n\n nil\n\n end"...
[ "0.7414049", "0.6685661", "0.65422535", "0.6070641", "0.6028717", "0.59874594", "0.59874594", "0.59874594", "0.5913772", "0.58877206", "0.58877206", "0.58868223", "0.58634716", "0.5840818", "0.58322746", "0.58257186", "0.5822077", "0.5816516", "0.58026886", "0.5795536", "0.57...
0.6110785
3
Removes all CORS rules attached to this bucket. bucket.cors.count => 3 bucket.cors.clear bucket.cors.count => 0
def clear client.delete_bucket_cors(:bucket_name => bucket.name) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_cors\n @bucket_cors.delete\n true\n rescue Aws::Errors::ServiceError => e\n puts \"Couldn't delete CORS rules for #{@bucket_cors.bucket.name}. Here's why: #{e.message}\"\n false\n end", "def removed_cors\n @aws.cors.rules - (@local.cors || [])\n end", "def added_cors\n ...
[ "0.7843477", "0.75620306", "0.6479524", "0.6401524", "0.6287629", "0.58730346", "0.57741576", "0.577237", "0.5769519", "0.57166946", "0.5590231", "0.55848", "0.5551601", "0.5487881", "0.5487881", "0.5487881", "0.54851735", "0.54374814", "0.54336375", "0.54336375", "0.5429699"...
0.7577958
1
alternative way of doing it def my_upto num arr = Array(self..num) p arr arr.each do |i| yield i end end
def my_times for i in 1..self yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upto(limit)\n return enum_for(:upto, limit) unless block_given?\n\n (self..limit).each { |fy| yield fy }\n end", "def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend", "def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i +=...
[ "0.7006084", "0.69655603", "0.69655186", "0.6944069", "0.69089025", "0.6842564", "0.6803425", "0.67432564", "0.67264205", "0.67181623", "0.6704803", "0.66436344", "0.66346496", "0.6602095", "0.66007334", "0.6593199", "0.6543565", "0.65407604", "0.6530602", "0.6530405", "0.652...
0.0
-1
/ Initialize zbuffer, projection matrix, light source, and lighting model. Do not specify a material property here.
def myinit position = [0.0, 3.0, 3.0, 0.0]; local_view = [0.0]; GL.Enable(GL::DEPTH_TEST); GL.DepthFunc(GL::LESS); GL.Light(GL::LIGHT0, GL::POSITION, position); GL.LightModel(GL::LIGHT_MODEL_LOCAL_VIEWER, local_view); GL.FrontFace(GL::CW); GL.Enable(GL::LIGHTING); GL.Enable(GL::LIGHT0); GL.Enable(GL::AUTO_NORMAL); GL.Enable(GL::NORMALIZE); GL.Enable(GL::FOG); fogColor = [0.5, 0.5, 0.5, 1.0]; fogMode = GL::EXP; GL.Fog(GL::FOG_MODE, fogMode); GL.Fog(GL::FOG_COLOR, fogColor); GL.Fog(GL::FOG_DENSITY, 0.35); GL.Hint(GL::FOG_HINT, GL::DONT_CARE); GL.ClearColor(0.5, 0.5, 0.5, 1.0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n mat_specular = [ 1.0, 1.0, 1.0, 1.0 ];\n light_position = [ 1.0, 1.0, 1.0, 0.0 ];\n\n GL.ClearColor(0.0, 0.0, 0.0, 0.0);\n GL.ShadeModel(GL::SMOOTH);\n GL.Enable(GL::DEPTH_TEST);\n GL.Material(GL::FRONT, GL::DIFFUSE, $diffuseMaterial);\n GL.Material(GL::FRONT, GL::SPECULAR, mat_specular);\...
[ "0.7218433", "0.6365604", "0.6299344", "0.61007434", "0.5911895", "0.5872389", "0.5635595", "0.5551103", "0.5492953", "0.54854167", "0.53656685", "0.53372777", "0.5322898", "0.52987057", "0.5292068", "0.52403736", "0.5221845", "0.51984245", "0.5195289", "0.51843226", "0.51746...
0.656252
1
GET /claim_submissions/1 GET /claim_submissions/1.json
def show @claim_submission = ClaimSubmission.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @claim_submission } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @claim_submission = ClaimSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @claim_submission }\n end\n end", "def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json...
[ "0.6813238", "0.6807171", "0.64583385", "0.6272739", "0.6244118", "0.6244118", "0.62435657", "0.6182019", "0.6182019", "0.61767715", "0.617586", "0.6171506", "0.60907423", "0.60907423", "0.60907423", "0.60907423", "0.60791945", "0.607315", "0.59617007", "0.5911678", "0.589942...
0.7241201
0
GET /claim_submissions/new GET /claim_submissions/new.json
def new @claim_submission = ClaimSubmission.new respond_to do |format| format.html # new.html.erb format.json { render json: @claim_submission } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @claim_submission = ClaimSubmission.new(params[:claim_submission])\n\n respond_to do |format|\n if @claim_submission.save\n format.html { redirect_to @claim_submission, notice: 'Claim submission was successfully created.' }\n format.json { render json: @claim_submission, statu...
[ "0.73083645", "0.730175", "0.70419043", "0.6944726", "0.6853168", "0.6849316", "0.68190694", "0.68190694", "0.6806833", "0.67574584", "0.6699049", "0.66672105", "0.66314304", "0.6609953", "0.65931195", "0.65611", "0.6553012", "0.65363985", "0.65244067", "0.6505716", "0.648817...
0.79409283
0
POST /claim_submissions POST /claim_submissions.json
def create @claim_submission = ClaimSubmission.new(params[:claim_submission]) respond_to do |format| if @claim_submission.save format.html { redirect_to @claim_submission, notice: 'Claim submission was successfully created.' } format.json { render json: @claim_submission, status: :created, location: @claim_submission } else format.html { render action: "new" } format.json { render json: @claim_submission.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n submission = Submission.new(submission_params)\n unless submission.save\n render json: {errors: submmission.errors.full_messages}, status: :bad_request\n return\n end\n\n claim = Claim.new(\n insured_id: submission.insured_id,\n provider_id: submission.provider_id\n ...
[ "0.71465874", "0.63417673", "0.6149975", "0.6113587", "0.61065835", "0.6066622", "0.60623986", "0.6039936", "0.6032935", "0.5940368", "0.5926616", "0.5919459", "0.5914436", "0.5873408", "0.58711284", "0.5820877", "0.58056426", "0.5804987", "0.5800932", "0.5794164", "0.5785113...
0.71877235
0
PUT /claim_submissions/1 PUT /claim_submissions/1.json
def update @claim_submission = ClaimSubmission.find(params[:id]) respond_to do |format| if @claim_submission.update_attributes(params[:claim_submission]) format.html { redirect_to @claim_submission, notice: 'Claim submission was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @claim_submission.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n submission = Submission.new(submission_params)\n unless submission.save\n render json: {errors: submmission.errors.full_messages}, status: :bad_request\n return\n end\n\n claim = Claim.new(\n insured_id: submission.insured_id,\n provider_id: submission.provider_id\n ...
[ "0.6415024", "0.6354963", "0.6158007", "0.61313814", "0.6063084", "0.5971259", "0.5859312", "0.5801251", "0.57798254", "0.57783216", "0.5768422", "0.5757671", "0.57420313", "0.5669171", "0.5662383", "0.56543", "0.5653432", "0.56460124", "0.5645715", "0.56304663", "0.56257087"...
0.7159447
0
DELETE /claim_submissions/1 DELETE /claim_submissions/1.json
def destroy @claim_submission = ClaimSubmission.find(params[:id]) @claim_submission.destroy respond_to do |format| format.html { redirect_to claim_submissions_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_submission = EmailSubmission.find(params[:id])\n @email_submission.destroy\n\n respond_to do |format|\n format.ht...
[ "0.71459085", "0.708304", "0.70242375", "0.70242375", "0.70242375", "0.69954276", "0.69857734", "0.69857734", "0.69855833", "0.6954726", "0.69509745", "0.69039905", "0.67750174", "0.6749984", "0.67270607", "0.66955394", "0.66955394", "0.66955394", "0.66955394", "0.66955394", ...
0.7863417
0
DELETE /admin/categories/1 DELETE /admin/categories/1.json
def destroy @setting.destroy respond_to do |format| format.html { redirect_to admin_settings_path, notice: 'Setting was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n...
[ "0.7854503", "0.7694885", "0.7646918", "0.7570219", "0.7551068", "0.7518432", "0.7471698", "0.7446149", "0.74312127", "0.74106044", "0.7381081", "0.7321815", "0.7294405", "0.72827524", "0.7278462", "0.7267943", "0.72662234", "0.72468024", "0.7243714", "0.7236379", "0.72359765...
0.0
-1
The uniq +signatures+ associated with the Threat.
def signature(i) raise "Not a signature!" unless i.is_a? Signature @signatures << i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signatures\n attributes.fetch(:signatures)\n end", "def signatures\n parsed {\n @signatures \n }\n end", "def signature_hexes\n return [] unless @vulnerability_finding_signatures_enabled && signatures.present?\n\n signatures.sort_by(&:priority).map(...
[ "0.6957771", "0.68488276", "0.6433961", "0.6181826", "0.6099277", "0.5983183", "0.59766895", "0.5969097", "0.5960114", "0.59397525", "0.5905269", "0.58706474", "0.5854063", "0.5842195", "0.5824132", "0.5627583", "0.5627583", "0.5622811", "0.56042063", "0.56042063", "0.5601840...
0.5808888
15
TODO reimplement smarter def signatures=(i) raise "Not a signature!" unless i.is_a? Signature
def signatures? @signatures ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature(i)\n raise \"Not a signature!\" unless i.is_a? Signature\n @signatures << i\n end", "def signature=(v)\n @signature = v\n end", "def set_Signature(value)\n set_input(\"Signature\", value)\n end", "def set_Signature(value)\n set_input(\"Signature\"...
[ "0.7683351", "0.7348437", "0.66040623", "0.66040623", "0.66040623", "0.66023916", "0.66023916", "0.66023916", "0.66023916", "0.66023916", "0.66023916", "0.66023916", "0.66023916", "0.65695566", "0.65695566", "0.65695566", "0.65695566", "0.65695566", "0.65695566", "0.65695316", ...
0.5551469
55
GET /aircraft_histories/1 GET /aircraft_histories/1.xml
def show @aircraft_history = AircraftHistory.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @aircraft_history } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def index\n #@histories = History.all\n @histories = History.find( :all, ...
[ "0.69748545", "0.66913915", "0.66322863", "0.6499734", "0.64886814", "0.63193476", "0.622778", "0.62066996", "0.61777604", "0.61715925", "0.614232", "0.6087778", "0.60778946", "0.607693", "0.60368115", "0.6023199", "0.6017405", "0.59801674", "0.5979623", "0.5979623", "0.59787...
0.704304
0
GET /aircraft_histories/new GET /aircraft_histories/new.xml
def new @aircraft_history = AircraftHistory.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @aircraft_history } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @aircraft = Aircraft.find(params[:aircraft_id])\n @aircraft_history = @aircraft.aircraft_histories.create(params[:aircraft_history])\n redirect_to aircraft_path(@aircraft)\n end", "def new\n @hpt_history = HptHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.7092833", "0.69028634", "0.6814686", "0.6809867", "0.67817616", "0.67567396", "0.6713136", "0.6688578", "0.66781557", "0.6595214", "0.6587581", "0.6546707", "0.65267587", "0.6519798", "0.6519798", "0.65143394", "0.65130866", "0.65061", "0.6501725", "0.647719", "0.6475656",...
0.7760129
0
POST /aircraft_histories POST /aircraft_histories.xml
def create @aircraft = Aircraft.find(params[:aircraft_id]) @aircraft_history = @aircraft.aircraft_histories.create(params[:aircraft_history]) redirect_to aircraft_path(@aircraft) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def new\n @aircraft_history = AircraftHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aircraft_history }\n end\n end", "def rss\n @event = Event.find_by_key(params['...
[ "0.6337723", "0.59994936", "0.588678", "0.58084923", "0.5748535", "0.5648055", "0.56187075", "0.5613745", "0.5592188", "0.55539745", "0.5476832", "0.54742116", "0.5469944", "0.5442814", "0.5433915", "0.5395365", "0.53786737", "0.5364867", "0.53593886", "0.5341449", "0.530511"...
0.7189772
0
PUT /aircraft_histories/1 PUT /aircraft_histories/1.xml
def update @aircraft_history = AircraftHistory.find(params[:id]) respond_to do |format| if @aircraft_history.update_attributes(params[:aircraft_history]) format.html { redirect_to(@aircraft_history, :notice => 'Aircraft history was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @aircraft_history.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @aircraft = Aircraft.find(params[:aircraft_id])\n @aircraft_history = @aircraft.aircraft_histories.create(params[:aircraft_history])\n redirect_to aircraft_path(@aircraft)\n end", "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historica...
[ "0.6193407", "0.5949652", "0.5938229", "0.5921804", "0.5873809", "0.5821155", "0.5758614", "0.57473296", "0.57473296", "0.57378584", "0.5707945", "0.5655108", "0.5635162", "0.5596993", "0.5574498", "0.5565909", "0.5565576", "0.55444473", "0.55292416", "0.5521721", "0.551546",...
0.6375209
0
DELETE /aircraft_histories/1 DELETE /aircraft_histories/1.xml
def destroy @aircraft_history = AircraftHistory.find(params[:id]) @aircraft_history.destroy respond_to do |format| format.html { redirect_to(aircraft_histories_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "d...
[ "0.6688579", "0.65868336", "0.6505595", "0.6488745", "0.6483323", "0.6396523", "0.6394068", "0.63887805", "0.63262826", "0.6304719", "0.6303515", "0.62910354", "0.6268343", "0.6266102", "0.62575483", "0.62019557", "0.6197609", "0.6196667", "0.618626", "0.61861223", "0.6182908...
0.7139268
0
=begin CONFIRM SALES RELATED =end
def confirm_post_production_history @post_production_history = PostProductionHistory.find_by_id params[:post_production_history_id] # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company @post_production_history.confirm( current_user ) @object = @post_production_history @parent = @object.sales_item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_order.confirm( current_user ) \n end", "def sell_confirmed\n end", "def confirm_order...
[ "0.6186503", "0.61625737", "0.6122685", "0.59879845", "0.5955981", "0.5955405", "0.5941831", "0.59390265", "0.5933362", "0.583504", "0.5790174", "0.5776659", "0.5765615", "0.5760621", "0.57591045", "0.57415", "0.5717416", "0.5684254", "0.5667012", "0.56591976", "0.56505203", ...
0.52956814
92
GET /members GET /members.xml
def index @session_member_id = session[:user].member.id @conn_ids = [] @session_member = Member.find(@session_member_id) @mcs = @session_member.member_connections unless @mcs.empty? @mcs.each do |mc| @conn_ids << mc.connected_member_id end end unless params["myconn"].blank? @myconn = params["myconn"] @search = Member.id_eq_any(@conn_ids).search(params[:search]) else @search = Member.descend_by_created_at.search(params[:search]) end unless params[:search_by_tags].blank? @searchtags = Tag.name_like(params[:search_by_tags]) @searchtags_ids = [] @searchtags.each do |tg| @searchtags_ids << tg.id end @search.member_taggings_tag_id_eq_any(@searchtags_ids) end if !params[:from_date_cal].blank? @report_start_date = Time.parse(params[:from_date_cal]) @search.member_attendances_created_at_greater_than(@report_start_date) end if !params[:end_date_cal].blank? @report_end_date = Time.parse(params[:end_date_cal]) @search.member_attendances_created_at_less_than(@report_end_date) end unless params[:coursedd].blank? @coursedd = params[:coursedd][:id] unless @coursedd.blank? sql = CourseSchedule.send(:construct_finder_sql, :select => 'id', :conditions => ["course_id = ?",@coursedd]) @cids = CourseSchedule.connection.select_values(sql) @search.member_attendances_course_schedule_id_eq_any(@cids) end end @csid = params["csid"] unless @csid.blank? @cs = CourseSchedule.find(@csid) @course = @cs.course @search.member_attendances_course_schedule_id_eq_any(@csid) end @center_id = session[:center_id]+"" @search.center_id_eq(@center_id) @members = @search.all.paginate :page => params[:page], :per_page => 10 @usermembers = User.user_members_cached(session[:center_id]) @tg = Tag.get_tag_names_cached(session[:center_id]) @courses = Course.all_cached @cs_id = -1 unless params["mode"].blank? render :layout => "signup", :template => "member_attendances/index" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end", "def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\...
[ "0.7903388", "0.7372727", "0.7194274", "0.7098234", "0.7059046", "0.69730103", "0.6923398", "0.69045466", "0.69045466", "0.68216807", "0.6803228", "0.6799462", "0.6763184", "0.6763184", "0.6763184", "0.6763184", "0.6763184", "0.6763184", "0.6763184", "0.6763184", "0.6763184",...
0.0
-1
GET /members/new GET /members/new.xml
def new @member = Member.new @centers = Center.find(:all) @mode = params[:mode] @csid = params[:csid] @emailid = params[:emailid] @myconn = params[:myconn] unless @emailid.nil? @member.emailid = @emailid end unless @mode.blank? render :layout => 'signup' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @member = Member.new\n @title = \"New member\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end", "def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re...
[ "0.7645127", "0.75905365", "0.75905365", "0.75905365", "0.73785937", "0.7339909", "0.73335916", "0.7262581", "0.71329445", "0.71195185", "0.71195185", "0.71195185", "0.71195185", "0.71195185", "0.71195185", "0.71195185", "0.70735514", "0.6980091", "0.69704103", "0.69519126", ...
0.0
-1
POST /members POST /members.xml
def create @member = Member.new(params[:member]) @session_member_id = session[:user].member.id @validatemember = Member.find(:all, :conditions => ["emailid = ?", @member.emailid]) if @validatemember.length == 0 @mode = params[:mode] @myconn = params[:myconn] if session[:current_user_super_admin] and @mode.blank? @member.center_id = params[:centersel][:id] else @member.center_id = session[:center_id] end @member.gender = params[:gender] if @member.save if @mode.blank? if @myconn.blank? flash[:notice] = 'Member was successfully created.' redirect_to params.merge!(:action => "index") else @member_connection = MemberConnection.new @member_connection.member_id = @session_member_id @member_connection.connected_member_id = @member.id @member_connection.save flash[:notice] = 'Member was successfully created.' redirect_to params.merge!(:action => "index", :myconn=>@myconn) end else @csid = params[:csid] @member_attendance = MemberAttendance.new @member_attendance.member = @member @member_attendance.center_id = session[:center_id] @member_attendance.course_schedule = CourseSchedule.find(@csid) if @member_attendance.save end redirect_to params.merge!(:controller=>"member_attendances", :action=>"show", :csid => @csid, :emailid => @member.emailid, :name => @member.fullname) end else if params[:mode].nil? render :action => "new", :csid => @csid, :mode => params[:mode] else render :action => "new", :csid => @csid, :mode => params[:mode], :layout => 'signup' end end else if params[:mode].blank? flash[:notice] = 'Member already Exists.' redirect_to params.merge!(:action => "new") else @csid = params[:csid] @member_attendance = MemberAttendance.new @member_attendance.member = @member @member_attendance.center_id = session[:center_id] @member_attendance.course_schedule = CourseSchedule.find(@csid) if @member_attendance.save end redirect_to params.merge!(:controller=>"member_attendances", :action=>"show", :csid => @csid, :emailid => @member.emailid, :name => @member.fullname) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @member = @current_enterprise.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n fo...
[ "0.61671525", "0.6156513", "0.61417735", "0.6114032", "0.6083187", "0.60502577", "0.6038692", "0.6017749", "0.60003173", "0.59865993", "0.5971774", "0.5899646", "0.58964914", "0.588346", "0.58806616", "0.58642143", "0.5863212", "0.5861496", "0.5853878", "0.58368444", "0.58368...
0.0
-1
PUT /members/1 PUT /members/1.xml
def save_fdate @member = Member.find(params[:mem_id]) @member.followupdate = Time.parse(params[:fdate]) @member.save respond_to do |format| format.html { redirect_to members_path } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to '/members/myindex' }\n format.xml { head :ok }\n else\n format.ht...
[ "0.62681997", "0.6248367", "0.6248367", "0.6235916", "0.62278175", "0.61481386", "0.6045742", "0.60422605", "0.6030557", "0.59456027", "0.59424746", "0.59080094", "0.5905808", "0.5904432", "0.59011877", "0.5881098", "0.5880963", "0.58590305", "0.5852408", "0.5852408", "0.5852...
0.0
-1
DELETE /members/1 DELETE /members/1.xml
def destroy @member = Member.find(params[:id]) @member.destroy respond_to do |format| format.html { redirect_to(members_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @member = Member.find(params[:id])\n @member.destroy\n \n \n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @member = Member.find(params[:id])\n @member.destroy\n respond_to do |format|\...
[ "0.7257433", "0.70842797", "0.70696974", "0.70696974", "0.70323604", "0.69961685", "0.6849304", "0.6777742", "0.6717248", "0.6684298", "0.6666834", "0.66305155", "0.6599085", "0.6599085", "0.6592147", "0.65882736", "0.65861404", "0.65861404", "0.6572019", "0.6572019", "0.6572...
0.7141851
3
Dump one fact type.
def fact_type_dump(fact_type, name) @fact_types_dumped[fact_type] = true return objectified_fact_type_dump(fact_type.entity_type) if fact_type.entity_type puts fact_type.scala_definition @metamodel << fact_type.scala_metamodel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fact_type_dump_with_dependents(fact_type)\n fact_type.ordered_dumped!\n return if skip_fact_type(fact_type)\n\n if (et = fact_type.entity_type) &&\n fact_type.all_role.size > 1 &&\n (pi = et.preferred_identifier) &&\n pi.role_sequence.all_role_r...
[ "0.6774727", "0.67335397", "0.6292088", "0.62656057", "0.6161495", "0.5973203", "0.5946446", "0.5662874", "0.56528383", "0.5648619", "0.56041765", "0.56018597", "0.5573867", "0.5552066", "0.55419964", "0.5519449", "0.55164355", "0.5495487", "0.54875857", "0.5486334", "0.54581...
0.83341646
0
authenticate_admin GET /user_funs GET /user_funs.json
def index @user_funs = UserFun.all respond_to do |format| format.html # index.html.erb format.json { render :json => @user_funs } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @user_fun = UserFun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_fun }\n end\n end", "def show\n @user_fun = UserFun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n form...
[ "0.67171574", "0.67171574", "0.6575392", "0.63004786", "0.6248893", "0.6089287", "0.60848415", "0.60662574", "0.60122967", "0.59738284", "0.5918241", "0.5916683", "0.59052306", "0.5879071", "0.5876672", "0.58741665", "0.5865761", "0.5865761", "0.5844039", "0.5844039", "0.5841...
0.6774119
0
GET /user_funs/1 GET /user_funs/1.json
def show @user_fun = UserFun.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @user_fun } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_funs = UserFun.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_funs }\n end\n end", "def my_fun_list\n user_funs = UserFun.find_all_by_user_id(session[:user_id])\n @user_funs = UserFun.find_all_by_user_id(session[:use...
[ "0.758615", "0.6828526", "0.65487033", "0.65487033", "0.6518973", "0.64706075", "0.6461234", "0.6221828", "0.6179859", "0.61411154", "0.6119363", "0.60906625", "0.6061644", "0.60502136", "0.59974766", "0.5989719", "0.5989719", "0.59849805", "0.5968624", "0.5959902", "0.595990...
0.7502344
2
GET /user_funs/new GET /user_funs/new.json
def new @user_fun = UserFun.new respond_to do |format| format.html # new.html.erb format.json { render :json => @user_fun } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @fun = Fun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fun }\n end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n e...
[ "0.73716295", "0.73560536", "0.73407894", "0.72152513", "0.7164537", "0.71468985", "0.70103586", "0.695236", "0.69225395", "0.6912087", "0.69076306", "0.6899815", "0.6872671", "0.6872671", "0.6868551", "0.68684214", "0.6860861", "0.6847907", "0.6823381", "0.6823381", "0.68233...
0.78505397
1
PUT /user_funs/1 PUT /user_funs/1.json
def update @user_fun = UserFun.find(params[:id]) respond_to do |format| if @user_fun.update_attributes(params[:user_fun]) format.html { redirect_to @user_fun, :notice => 'User fun was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @user_fun.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @fun.update(fun_params)\n format.html { redirect_to @fun, notice: 'Fun was successfully updated.' }\n format.json { render :show, status: :ok, location: @fun }\n else\n format.html { render :edit }\n format.json { render json: @fun.e...
[ "0.6353547", "0.6350216", "0.6221167", "0.6041664", "0.600621", "0.60039973", "0.59994996", "0.598807", "0.598807", "0.5945116", "0.583446", "0.580848", "0.5807766", "0.5788849", "0.57870704", "0.5733116", "0.57325166", "0.5731583", "0.57263786", "0.57020533", "0.5671742", ...
0.7342087
1
DELETE /user_funs/1 DELETE /user_funs/1.json
def destroy @user_fun = UserFun.find(params[:id]) @user_fun.destroy respond_to do |format| format.html { redirect_to user_funs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fun = Fun.find(params[:id])\n @fun.destroy\n\n respond_to do |format|\n format.html { redirect_to funs_url }\n format.json { head :no_content }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "...
[ "0.6992293", "0.69635135", "0.68825", "0.68398446", "0.68136066", "0.67572737", "0.6698803", "0.66330427", "0.66330427", "0.663094", "0.6623205", "0.66100335", "0.6599963", "0.65765154", "0.65672076", "0.65511775", "0.6548282", "0.6539716", "0.6539565", "0.65371895", "0.65352...
0.76978886
1
authenticate_user register fun POST /user_funs POST /user_funs.json create INPUT: fun_id (value) OUTPUT: SAVE user_fun (UserFun.object), fun.popularity +1 FROM: views/funs/list_selected TO: 2012.7.6 Yueying
def create hash = params[:register] if hash != nil user_fun = UserFun.new user_fun.user_id = current_user.id hash_invert = hash.invert user_fun.fun_id = hash_invert.values_at("register").first.to_i user_fun.save fun = user_fun.fun sql = ActiveRecord::Base.connection() sql.execute("UPDATE funs SET funs.popularity = funs.popularity + 1 WHERE funs.id = " + fun.id.to_s) end respond_to do |format| format.html { redirect_to '/users/home' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n hash = params[:register]\n\n if hash != nil\n user_fun = UserFun.new\n user_fun.user_id = session[:user_id]\n hash_invert = hash.invert\n user_fun.fun_id = hash_invert.values_at(\"register\").first.to_i\n user_fun.save\n\n fun = user_fun.fun\n sql = ActiveReco...
[ "0.81044847", "0.62539935", "0.62117267", "0.62008613", "0.6184326", "0.5888632", "0.5888632", "0.58826387", "0.58337003", "0.58322114", "0.58198047", "0.57927793", "0.57707685", "0.57703114", "0.5749007", "0.57120514", "0.5696879", "0.5694718", "0.56727064", "0.5668079", "0....
0.8103665
1
attend fun attend INPUT: user_fun_id (value), user_id (session value) OUTPUT: SAVE user_point, team_point, user_fun.attend FROM: /views/funs/my_fun_list TO: 2012.7.17 Yueying
def attend # update user_fun.is_attend user_fun = UserFun.find(params[:user_fun_id]) user_fun.update_attribute(:is_attend, 1) # save user_point user_point = UserPoint.new user_point.add_point(current_user.id, 30000, 'fun') # save team_point team_point = TeamPoint.new team = Team.find_by_user1(current_user.id) team_point.add_point(team.id, 30000) redirect_to '/users/home' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attend\n\n @event = Event.find(params[:id])\n if attending?\n @text = \"unattended\"\n else\n @attendee =@event.attendees.create(user_id: current_user.id)\n @text = \"attending\"\n end\n redirect_to event_path(@event)\n end", "def invite\n \...
[ "0.5802408", "0.56107306", "0.55837446", "0.5581934", "0.5563374", "0.5479594", "0.54458916", "0.5440408", "0.5437752", "0.5430034", "0.5400913", "0.5358919", "0.5355068", "0.53386754", "0.5335862", "0.5323309", "0.531489", "0.53122133", "0.52920073", "0.5260539", "0.5234853"...
0.75433725
0
Downloads the source file to the destination file. It is up to implementors of this class to handle the logic.
def download!(source_url, destination_file); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file(source, destination, targets)\n destination = File.expand_path(destination, Dir.pwd)\n targets = inventory.get_targets(targets)\n\n with_benchmark do\n executor.download_file(targets, source, destination)\n end\n end", "def download_bad_way(destination_path, so...
[ "0.664336", "0.65572953", "0.6548299", "0.64787436", "0.646987", "0.63807416", "0.63784015", "0.63293827", "0.6324968", "0.63138986", "0.62876976", "0.62316144", "0.6208024", "0.61742264", "0.61642087", "0.6158972", "0.6158867", "0.6157813", "0.61549294", "0.61214465", "0.611...
0.7652758
0
GET /projects GET /projects.json
def index @projects = current_user.projects end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8574897", "0.8386689", "0.8355737", "0.8062607", "0.80368364", "0.8002139", "0.78593457", "0.7834634", "0.78324", "0.7799698", "0.77792805", "0.7748103", "0.77139485", "0.7700251", "0.7696023", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", ...
0.7031996
85
GET /projects/1 GET /projects/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7868971", "0.76979554", "0.7680216", "0.7611453", "0.75334454", "0.75258976", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74924207", "0.7484109", "0.7479275", "0.7444873", "0.74294627", "0.74224764", "0.7414947", "0....
0.0
-1
POST /projects POST /projects.json
def create @project = Project.new(project_params) @project.owner = current_user @pu = current_user.projectusers.new @pu.project = @project @pu.save respond_to do |format| if @project.save format.html { redirect_to @project, notice: 'Project was successfully created.' } format.json { render :show, status: :created, location: @project } else format.html { render :new } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338948", "0.73139244", "0.7308003", "0.7299582", "0.7227503", "0.7225945", "0.71982473", "0.71170384", "0.7104803", "0.7095263", "0.7070636", "0.70408624", "0.70358187", "0.7024969", "0.70191896", "0.7009597", "0.698481", "0.697517", "0.6963753", "0.6963096", "0.6948756",...
0.0
-1
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html { redirect_to @project, notice: 'Project was successfully updated.' } format.json { render :show, status: :ok, location: @project } else format.html { render :edit } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\...
[ "0.70004326", "0.69119745", "0.6911138", "0.6889052", "0.6888448", "0.6878091", "0.68675476", "0.6857582", "0.685334", "0.685334", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68...
0.6600113
97
DELETE /projects/1 DELETE /projects/1.json
def destroy @project.destroy respond_to do |format| format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7704753", "0.7704753", "0.7704753", "0.7704753", "0.7704753...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = current_user.projects.friendly.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 project_params params.require(:project).permit(:name, :description, :make_public, :user_key) 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
Medium Problems 2, Question 6 TriAngles A triangle is classified as follows: right: One angle of the triangle is a right angle (90 degrees) acute: All 3 angles of the triangle are less than 90 degrees obtuse: One angle is greater than 90 degrees. To be a valid triangle, the sum of the angles must be exactly 180 degrees, and all angles must be greater than 0: if either of these conditions is not satisfied, the triangle is invalid. Write a method that takes the 3 angles of a triangle as arguments, and returns a symbol :right, :acute, :obtuse, or :invalid depending on whether the triangle is a right, acute, obtuse, or invalid triangle. You may assume integer valued angles so you don't have to worry about floating point errors. You may also assume that the arguments are specified in degrees.
def triangle(a, b, c) angles = [a, b, c] # angles.sum = angles.reduce(:+) return :invalid if angles.sum != 180 || angles.any?(0) return :right if angles.any?(90) return :acute if angles.all? { |angle| angle < 90 } :obtuse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid if angles.sum != 180\n return :invalid if angles.any? {|angle| angle <= 0}\n return :right if angles.any? {|angle| angle == 90}\n return :acute if angles.all? {|angle| angle < 90}\n return :obtuse if angles.any? {|angl...
[ "0.8828743", "0.8763122", "0.8740323", "0.86614907", "0.8656667", "0.8656506", "0.8653808", "0.86374104", "0.8614228", "0.861255", "0.8605746", "0.8579279", "0.85604286", "0.85501456", "0.85054255", "0.84894484", "0.8483375", "0.8473427", "0.8462924", "0.83186036", "0.8299050...
0.8712764
3
GET /outmails GET /outmails.json
def index @outmails = Outmail.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end", "def index\n @emails = Email.all\n json_response(@emails)\n end", "def index\n @emails = @user.emails\n\n r...
[ "0.6662594", "0.6617626", "0.6471754", "0.6471754", "0.6435658", "0.63467026", "0.6313058", "0.6282166", "0.62671053", "0.6201223", "0.6184651", "0.60781384", "0.607289", "0.6066874", "0.604244", "0.6040889", "0.60359544", "0.5984598", "0.59760356", "0.59663045", "0.59570825"...
0.75974256
0
GET /outmails/1 GET /outmails/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @outmails = Outmail.all\n end", "def index\n @emails = Email.all\n json_response(@emails)\n end", "def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end"...
[ "0.7270228", "0.66655177", "0.65874594", "0.6584399", "0.6565151", "0.6565151", "0.6556329", "0.63845557", "0.6376616", "0.62930006", "0.6280007", "0.6239732", "0.62341446", "0.62257296", "0.62030625", "0.6178607", "0.61752516", "0.6156806", "0.61275905", "0.6104248", "0.6099...
0.0
-1
POST /outmails POST /outmails.json
def create @outmail = Outmail.new(outmail_params) respond_to do |format| if @outmail.save format.html { redirect_to @outmail, notice: 'Outmail was successfully created.' } format.json { render :show, status: :created, location: @outmail } else format.html { render :new } format.json { render json: @outmail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outmail_params\n params.require(:outmail).permit(:title, :to, :datesend, :mailtext, :response)\n end", "def index\n @outmails = Outmail.all\n end", "def destroy\n @outmail.destroy\n respond_to do |format|\n format.html { redirect_to outmails_url, notice: 'Outmail was successfully des...
[ "0.66350275", "0.64947957", "0.6109473", "0.5841467", "0.58384764", "0.5626277", "0.5548303", "0.55094033", "0.5487426", "0.54558563", "0.52912575", "0.5282537", "0.5274942", "0.5267035", "0.52233577", "0.5219571", "0.52139235", "0.5199292", "0.51882917", "0.5153854", "0.5089...
0.69465715
0
PATCH/PUT /outmails/1 PATCH/PUT /outmails/1.json
def update respond_to do |format| if @outmail.update(outmail_params) format.html { redirect_to @outmail, notice: 'Outmail was successfully updated.' } format.json { render :show, status: :ok, location: @outmail } else format.html { render :edit } format.json { render json: @outmail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n remove_email_dependencies\n migrate_template_to_email\n respond_to do |format|\n if @email.save\n build_emails\n format.html {redirect_to emails_url, notice: 'Email was updated.'}\n format.json {render :index, status: :ok }\n else\n format.html {render :e...
[ "0.6490116", "0.6359001", "0.6267009", "0.61628485", "0.61537343", "0.6149882", "0.6140833", "0.61353207", "0.6077239", "0.60719633", "0.60473126", "0.6039272", "0.6033884", "0.6032661", "0.6022152", "0.6011104", "0.6011002", "0.5973488", "0.59649724", "0.59647995", "0.595535...
0.70983607
0
DELETE /outmails/1 DELETE /outmails/1.json
def destroy @outmail.destroy respond_to do |format| format.html { redirect_to outmails_url, notice: 'Outmail was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mail.destroy\n respond_to do |format|\n format.html { redirect_to mails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ourmail.destroy\n respond_to do |format|\n format.html { redirect_to ourmails_url }\n format.json { head :no_content }\...
[ "0.7261736", "0.71905136", "0.7028897", "0.6978332", "0.6911046", "0.6895673", "0.68913597", "0.68913597", "0.68858176", "0.68458706", "0.6802125", "0.67750746", "0.67691565", "0.67633086", "0.67427605", "0.67371416", "0.6714568", "0.6711987", "0.670825", "0.67059284", "0.670...
0.7249165
1
Use callbacks to share common setup or constraints between actions.
def set_outmail @outmail = Outmail.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 outmail_params params.require(:outmail).permit(:title, :to, :datesend, :mailtext, :response) 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
needed for pseudoIO functionality
def print(*args); msg channel, args.join(" "); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def io; end", "def io; end", "def io; end", "def io; end", "def by_magic(io); end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read() end", "def all_by_magic(io); end", "def io_lock; end", "def output=(io...
[ "0.694438", "0.694438", "0.694438", "0.694438", "0.6928438", "0.66444653", "0.66444653", "0.66444653", "0.66444653", "0.66444653", "0.66444653", "0.66444653", "0.65722716", "0.65182114", "0.6416524", "0.62973624", "0.6253669", "0.6250688", "0.6235205", "0.6225663", "0.6214579...
0.0
-1
'initialize' is in base
def handle(command) super do check_schedule_validity(command) show_short_schedule(@schedule.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize() end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\nend", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initializ...
[ "0.79208535", "0.77879363", "0.77879363", "0.77879363", "0.77879363", "0.7662159", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.7626896", "0.75987947", "0.758498", "0.7558257", "0.7490796"...
0.0
-1
Return a string representing the unary minus function
def inspect "-(#{operand.inspect})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unary_minus\n UnaryMinus.new(self)\n end", "def subtract\n match '-'\n term\n emit_ln 'SUB (SP)+, D0'\n emit_ln 'NEG D0'\nend", "def operator\n '-'\n end", "def unary\n if match?(:bang, :minus)\n operator = previous\n right = unary\n return Ri...
[ "0.7579631", "0.7227036", "0.6905304", "0.68995774", "0.66972303", "0.6682178", "0.6647178", "0.6603301", "0.6546344", "0.6545465", "0.6535508", "0.6501532", "0.64748496", "0.64642286", "0.6456332", "0.64414006", "0.6413191", "0.6401789", "0.6401789", "0.6401789", "0.6401789"...
0.7053564
2
Return a unary minus function
def unary_minus UnaryMinus.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unary\n if match?(:bang, :minus)\n operator = previous\n right = unary\n return Ringo::Unary.new(operator, right)\n end\n\n return call\n end", "def negative(num)\n - num.abs\nend", "def unary\r\n if consume(\"+\")\r\n unary()\r\n elsif consume(\"-\")\r\n new...
[ "0.77617466", "0.7279514", "0.72100866", "0.7196679", "0.71557677", "0.7085589", "0.7085589", "0.7085589", "0.7085589", "0.7055862", "0.7007924", "0.69345987", "0.6868508", "0.6864128", "0.6864128", "0.6864128", "0.6864128", "0.68543804", "0.6849356", "0.6844577", "0.68321157...
0.8064377
0
Current price of BTC in USD (float returned).
def price(currency = 'USD') best_of('price') do |api| api.price(currency) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_value_usd\n @quantity * price_in_usd\n end", "def price\n (price_in_cents / 100.0) unless price_in_cents.nil?\n end", "def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n ...
[ "0.7496824", "0.743165", "0.7418935", "0.73806006", "0.73665506", "0.73621905", "0.7355877", "0.7292291", "0.7215419", "0.7191245", "0.71680725", "0.7165655", "0.71636397", "0.7157195", "0.70857084", "0.7057009", "0.70539796", "0.70490247", "0.70330375", "0.6970452", "0.68587...
0.0
-1
Gets the balance of the address, in satoshi.
def balance(address) best_of('balance') do |api| api.balance(address) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://api.blockchair.com/bitcoin/dashboards/address').append(address).fragment(the_key)\n )['data'][address]\n if json.nil?\n @log.info(\"Address #{address} not found\")\n return 0\n end...
[ "0.79297596", "0.7650384", "0.7475143", "0.74137586", "0.7399117", "0.7330787", "0.73150444", "0.718895", "0.70118725", "0.6929778", "0.67927784", "0.6729396", "0.6651305", "0.6649159", "0.6649159", "0.66137683", "0.65630424", "0.6541119", "0.6535886", "0.64929444", "0.641210...
0.7381385
5
Get the height of the block.
def height(hash) best_of('height') do |api| api.height(hash) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height\n return @height\n end", "def height_for_block(hash)\n height = guard_block_index_access do\n bh = @block_index.block_header_for_hash(hash)\n bh && bh.height\n end\n return height if height\n b = Toshi::Models::Block.where(hsh: hash).first\n ...
[ "0.7786715", "0.7781199", "0.77548134", "0.76288193", "0.7561129", "0.74649537", "0.742671", "0.74187046", "0.73506665", "0.7308628", "0.728245", "0.7275607", "0.7272264", "0.7221262", "0.7216523", "0.7182836", "0.718262", "0.718262", "0.7166424", "0.71382993", "0.7138244", ...
0.0
-1
Get the hash of the next block.
def next_of(hash) best_of('next_of') do |api| api.next_of(hash) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_block\n @store.get_block_by_prev_hash(@hash)\n end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest ...
[ "0.7380781", "0.72743124", "0.72159004", "0.6941488", "0.65778035", "0.6418618", "0.6365502", "0.63542974", "0.6259321", "0.62465227", "0.62434775", "0.62348044", "0.62256366", "0.6200852", "0.6192944", "0.61860096", "0.618219", "0.61220145", "0.61123574", "0.6039915", "0.601...
0.0
-1
Fetch all unspent outputs per address.
def utxos(keys) best_of('utxos') do |api| api.utxos(keys) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_unspent(oa_address_list = [])\n btc_address_list = oa_address_list.map { |oa_address| oa_address_to_address(oa_address)}\n outputs = get_unspent_outputs(btc_address_list)\n result = outputs.map{|out| out.to_hash}\n result\n end", "def unspent(addresses)\n get(\"addr/\"+addr...
[ "0.74234736", "0.74061245", "0.74047816", "0.7228166", "0.7008339", "0.6902819", "0.6902819", "0.6883551", "0.6491622", "0.626691", "0.5968497", "0.58821744", "0.58666724", "0.5866372", "0.57557076", "0.55428255", "0.5439235", "0.5407304", "0.5391183", "0.52985644", "0.523151...
0.0
-1
Push this transaction (in hex format) to the network.
def push(hex) best_of('push') do |api| api.push(hex) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(hex)\n Sibit::Json.new(http: @http, log: @log).post(\n Iri.new('https://api.blockchair.com/bitcoin/push/transaction').fragment(the_key),\n \"data=#{hex}\"\n )\n @log.info(\"Transaction (#{hex.length} in hex) has been pushed to Blockchair\")\n end", "def send\n Chain....
[ "0.7770981", "0.74936837", "0.6628756", "0.62979555", "0.6219501", "0.616331", "0.60115564", "0.6001621", "0.5934116", "0.5780398", "0.57279056", "0.5697864", "0.5692557", "0.56908506", "0.56901455", "0.5613454", "0.56000316", "0.5577189", "0.5573167", "0.5544541", "0.5516488...
0.6494391
3
This method should fetch a block and return as a hash.
def block(hash) best_of('block') do |api| api.block(hash) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block(blk_hash)\n raise \"Not implemented\"\n end", "def get_broadhash\n blocks = self.blocks_get_status\n if blocks[\"success\"]\n return blocks[\"broadhash\"]\n else\n return nil\n end\n end", "def block(hash)\n head = Sibit::Json.new(http: @http,...
[ "0.72323686", "0.69136924", "0.68672067", "0.68660164", "0.6729535", "0.6724822", "0.6699785", "0.66763395", "0.6673845", "0.66024655", "0.65771776", "0.6576785", "0.65620834", "0.6533197", "0.6496154", "0.648678", "0.64812875", "0.633472", "0.6256645", "0.62354255", "0.62222...
0.6190091
22
GET /auctions/1 GET /auctions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def show\n render json: @auction\n end", "def show\n\t\trender json: @auction_item.as_jso...
[ "0.77117133", "0.7681789", "0.75758666", "0.7447109", "0.7319728", "0.71859163", "0.7030111", "0.7006114", "0.6900339", "0.6871605", "0.6832682", "0.6764159", "0.6754685", "0.67412204", "0.6713402", "0.67072374", "0.67071885", "0.66385025", "0.65081954", "0.64939857", "0.6490...
0.0
-1
Returns a new +Mail::Part+ with the same content and MIME headers as the message passed as an argument. Although Mail gem provides +Mail::Messageconvert_to_multipart+ method, it works correctly for nonmultipart text/plain messages only. This method is more robust, and handles messages containing any content type, be they multipart or not. The message passed as an argument is not altered. TODO Copy MIME headers (ones which start with "Content") TODO Preserve ContentTransferEncoding when possible TODO Set some safe ContentTransferEncoding, like quotedprintable
def body_to_part(message) part = ::Mail::Part.new part.content_type = message.content_type if message.multipart? message.body.parts.each { |p| part.add_part duplicate_part(p) } else part.body = message.body.decoded end part end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(headers, body)\n content_type = headers['Content-Type']\n boundary = content_type.parameters['boundary']\n\n if boundary.nil?\n raise Malformed.new(\"Expected multipart Content-Type header to contain 'boundary' parameter\",\n 1)\n else...
[ "0.61831546", "0.60385853", "0.60258377", "0.59242654", "0.569401", "0.5650386", "0.556802", "0.55310506", "0.55279696", "0.5503629", "0.5468469", "0.5391712", "0.5383793", "0.5360579", "0.5327401", "0.52827686", "0.52722377", "0.5253468", "0.52444655", "0.52317613", "0.51520...
0.73677135
0
Duplicates a message part, preserving its ContentID if present.
def duplicate_part(part) duplicate = part.dup duplicate.add_content_id(part.content_id) unless part.content_id.nil? duplicate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.dup}\n ZMQ::StringMultipartMessage.new(dup_frames)\n end", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.duplicate}\n ZMQ::RawMultipartMessage.new(dup_frames)\n end", "def set_duplicate_message(message, clone)\...
[ "0.6750182", "0.6711373", "0.6142976", "0.59297216", "0.56527936", "0.561795", "0.56056607", "0.55850834", "0.5555147", "0.5487492", "0.5387761", "0.5357841", "0.534906", "0.53393614", "0.5322278", "0.5310345", "0.5227316", "0.52197605", "0.518457", "0.517322", "0.5138059", ...
0.77275276
0
Detects a list of emails which should be used to define a list of recipients of encrypted message. All is simply taken from the message +To:+ field.
def find_recipients_for(message) message.to_addrs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipients_list\n to.split(/\\s*,\\s*/)\n end", "def recipients\n notified_users.collect(&:mail)\n end", "def recipients_from_body\n @recipients_from_body ||= begin\n emails_from_body = body.scan(EMAIL_REGEX)\n address_list_for(emails_from_body, true)\n rescue Mail::Fiel...
[ "0.7336624", "0.7215735", "0.7149188", "0.70851874", "0.7072927", "0.70481575", "0.7017761", "0.7013778", "0.6957835", "0.69124275", "0.6892243", "0.6887032", "0.6838883", "0.68354833", "0.680716", "0.68064696", "0.67985475", "0.67819834", "0.67250377", "0.67250377", "0.67092...
0.6424487
47
Detects email which should be used to find a message signer key. Basically, it is taken from the message +From:+ field, but may be overwritten by +:signer+ adapter option.
def find_signer_for(message) options[:signer] || message.from_addrs.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender_email\n msg['from_email'] || msg['sender'] || entry['sender'] || reject['sender']\n end", "def from_email\n AppConfig[:pui_request_email_fallback_from_address]\n end", "def mail_from\n if @yaml[\"mail\"][\"from\"] != \"example@example.com\"\n return @yaml[\"mail\"][\"from\"]\...
[ "0.6344786", "0.6035565", "0.59352106", "0.5764179", "0.5728069", "0.56504536", "0.5629755", "0.5609708", "0.54774934", "0.5453946", "0.5441865", "0.54181695", "0.5406117", "0.54011726", "0.5400863", "0.53920156", "0.53900605", "0.5389332", "0.5374156", "0.5355137", "0.534385...
0.69793427
0
Replaces a message body. Clears all the existing body, be it multipart or not, and then appends parts passed as an argument.
def rewrite_body(message, content_type:, parts: []) message.body = nil message.content_type = content_type parts.each { |p| message.add_part(p) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_in_pure_html_message(new_part)\n if new_part.content_type.include?('text/html')\n message.body = new_part.decoded\n message.content_type = new_part.content_type\n else\n message.body = nil\n message.content_type = new_part.content_type\n new_pa...
[ "0.6492179", "0.6316403", "0.63132346", "0.6295004", "0.6236843", "0.59948057", "0.5994469", "0.5994469", "0.5964942", "0.5960431", "0.59463966", "0.58319706", "0.58181804", "0.577461", "0.5750326", "0.57361454", "0.57271147", "0.57247853", "0.5715063", "0.57140785", "0.57105...
0.79076236
0
GET /teams/1 GET /teams/1.json
def show # /teams/1 if !params[:id].nil? @team = Team.find(params[:id]) @division = @team.divisions.first end # Old FAFT Route is passed if !params[:faft_team_id].nil? && !params[:faft_ds_id].nil? @division = DivisionSeason.find_by_faft_id(params[:faft_ds_id]) redirect_to '/search?q=' + params[:team_slug] and return if @division.nil? @team = @division.teams.find_by_faft_id(params[:faft_team_id]) @team = Team.find_by_faft_id(params[:faft_team_id]) if @team.nil? head(:moved_permanently, location: default_team_path(@team)) and return end # Find team by league, division, team slug if !params[:league_slug].nil? && !params[:division_slug].nil? && !params[:team_slug].nil? @league = League.find_by_slug(params[:league_slug]) redirect_to '/search?q=' + params[:team_slug] and return if @league.nil? @divisions = @league.divisions @division = @divisions.select{ |ds| !ds.nil? && ds.slug == params[:division_slug] }.first #should only be one redirect_to '/search?q=' + params[:team_slug] and return if @division.nil? @team = @division.teams.find_by_slug(params[:team_slug]) redirect_to '/search?q=' + params[:team_slug] and return if @team.nil? end # Redirect tenanted teams to the right domain # - This check should be performed as soon as it can be change_domain, host = change_domain_for_tenanted_model?(@team) redirect_to team_url(@team, host: host) and return if change_domain authorize! :read, @team user_cache_key = "" user_cache_key = current_or_guest_user.rabl_cache_key if (!current_or_guest_user.nil?) @user = current_or_guest_user @events_cache_key = "EventsFragment/#{user_cache_key}/TeamProfile/#{@team.cache_key}/#{@team.events_last_updated_at.utc.to_s(:number)}" # tenant info @tenant = LandLord.new(@team).tenant @tenant_json = Rabl.render(@tenant, 'api/v1/tenants/show', view_path: 'app/views', formats: :json, locals: { page: "team" }).html_safe # Show/hide page elements @show_download_app_marketing = !@team.is_o2_touch_team? @show_results_section = !@team.is_o2_touch_team? x = time do @activity_items_json = [].to_json feed_cache_key = @team.feed_cache_key(:profile, nil, nil, 20, nil) logger.info "BF Cache - Feed cache_key is #{feed_cache_key}" @activity_items_json = fetch_from_cache "#{feed_cache_key}" do x = Rabl.render(@team.get_mobile_feed(:profile, nil, nil, 20, nil)[0], "api/v1/activity_items/index", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe safe_js_string(x) end end logger.debug "BF Cache - Activity Items" + (x.to_s) x = time do #4-5s (7 events) @future_events_json = Rails.cache.fetch @events_cache_key + "/future"do json_collection(@team.future_events, @user).html_safe end @past_events_json = Rails.cache.fetch @events_cache_key + "/past" do json_collection(@team.past_events, @user).html_safe end end logger.debug "BF Cache - Events" + (x.to_s) template = (can? :manage, @team) ? 'api/v1/users/index_reduced_squad_private' : 'api/v1/users/index_reduced_squad' @members_json = Rabl.render(@team.members, template, view_path: 'app/views', formats: [:json], :scope => BFFakeContext.new, locals: { :team => @team }, handlers: [:rabl]).html_safe # Why do we use @demo_final? Does this need to refactored out? - PR x = time do @team_json = Rails.cache.fetch "#{@team.rabl_cache_key}/#{@demo_final}" do Rabl.render(@team, "api/v1/teams/show", view_path: 'app/views', :locals => { :demo_final => @demo_final }, :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end logger.debug "BF Cache - Team under view" + (x.to_s) x = time do @current_user_teams_json = [].to_json if !current_or_guest_user.nil? @current_user_teams_json = Rails.cache.fetch "#{current_or_guest_user.rabl_cache_key}/CurrentTeams" do Rabl.render(current_or_guest_user.teams, "api/v1/teams/index", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end end logger.debug "BF Cache - Current teams" + (x.to_s) x = time do @current_user_leagues_json = [].to_json if !current_user.nil? @current_user_leagues_json = Rabl.render(current_user.leagues_as_organiser, "api/v1/leagues/index", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end logger.debug "BF Cache - Current leagues" + (x.to_s) x = time do @user_json = {}.to_json if !current_user.nil? @user_json = Rails.cache.fetch "#{@user.rabl_cache_key}" do Rabl.render(@user, "api/v1/users/show", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end end logger.debug "BF Cache - User" + (x.to_s) #Get combined user and team goals @goals_json = [].to_json if @team and @user combined_goals = @team.goals.get_items.merge(@user.goals.get_items) combined_goals_json_array = combined_goals.map do |key, goal_checklist_item| goal_checklist_item.to_json end @goals_json = combined_goals_json_array.to_json.html_safe end #Open invite link is required iff the user is an organiser. If this information is put in the json, #we end up with complicated rabl cacheing where a team is cached per user. Therefore the simple solution #as it stands is to put the information in the markup. @open_invite_link = @team.open_invite_link render "show_private" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team(id)\n get \"/teams/#{id}\"\n end", "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def show\n @team = Team.find(params[:id])\n\n render json: @team\n end", "def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.jso...
[ "0.7996014", "0.7838169", "0.7753974", "0.7667755", "0.7657437", "0.76113945", "0.7591232", "0.758825", "0.7579617", "0.75722426", "0.7572136", "0.7572136", "0.75414246", "0.7532713", "0.7532713", "0.75120324", "0.75120324", "0.75120324", "0.75120324", "0.7472558", "0.7470411...
0.0
-1
Show public profile template
def no_permissions # TODO: Refactor this to use private team rabl template @team_json = Rails.cache.fetch "#{@team.rabl_cache_key}/#{@demo_final}" do Rabl.render(@team, "api/v1/teams/show_reduced_gamecard", view_path: 'app/views', :locals => { :demo_final => @demo_final }, :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end @user = current_user if @user.nil? # tenant info @tenant = LandLord.new(@team).tenant @tenant_json = Rabl.render(@tenant, 'api/v1/tenants/show', view_path: 'app/views', formats: :json, locals: { page: "team" }).html_safe # TODO: This is duplicated in the show action above - could refactor @user_json = {}.to_json unless current_user.nil? @user_json = Rails.cache.fetch "#{current_user.rabl_cache_key}" do Rabl.render(@user, "api/v1/users/show", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end @current_user_teams_json = [].to_json unless current_or_guest_user.nil? @current_user_teams_json = Rails.cache.fetch "#{current_or_guest_user.rabl_cache_key}/CurrentTeams" do Rabl.render(current_or_guest_user.teams, "api/v1/teams/index", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end end @current_user_leagues_json = [].to_json unless current_user.nil? @current_user_leagues_json = Rabl.render(current_user.leagues_as_organiser, "api/v1/leagues/index", view_path: 'app/views', :formats => [:json], :scope => BFFakeContext.new, :handlers => [:rabl]).html_safe end # Meta-tags title = (!@division.nil? && !@division.league.nil?) ? @team.name + " | " + @division.league.title : @team.name set_meta_tags :title => title return render 'show_public_restricted' unless can? :view_public_profile, @team ##### PUBLIC TEAM - SHOW PUBLIC PAGE ##### # Public Meta-tags set_meta_tags :description => "The #{@team.name} Full Team Page. Browse upcoming games, latest results and team news here. Stay up-to-date - View the team page now!" set_meta_tags :keywords => %W[fixtures schedule results scores games #{@team.name}] @division = @team.divisions.first if @division.nil? @bf_club_teams = @team.club.teams unless @team.nil? || @team.club.nil? # USER FOLLOWING? @user_following = !current_user.nil? && @team.has_associate?(current_user) # USER DOWNLOADED APP? @current_user_has_downloaded_app = !current_user.nil? && !current_user.mobile_devices.empty? # ROLLOUT: DOWNLOAD THE APP LINK @download_the_app = current_user.nil? ? $rollout.active?(:faft_follow_team) : $rollout.active?(:faft_follow_team, current_user) @show_facebook_signup = false @division_presenter = DivisionPresenter.new(@division) @division_cache_prefix = @division.nil? ? "" : "division/#{@division.id}-#{@division.updated_at.to_i}/" if @division.nil? @future_fixture_events = @team.future_events else @future_fixtures = @division.fixtures.future.all.keep_if { |f| (f.home_team_id == @team.id || f.away_team_id == @team.id) } @future_fixture_events = @future_fixtures.map { |f| f.event_for_team(@team) } maximum_updated_at = @division.fixtures.future.maximum(:updated_at) end @future_events = EventsPresenter.new(@future_fixture_events).events @future_events_cache = @division_cache_prefix + "team/#{@team.id}/future_events/#{@future_events.size}-#{maximum_updated_at.to_i}" if @division.nil? @past_fixture_events = @team.past_events else @past_fixtures = @division.fixtures.past.all.keep_if { |f| f.home_team_id == @team.id || f.away_team_id == @team.id } @past_fixture_events = @past_fixtures.map { |f| f.event_for_team(@team) } maximum_updated_at = @division.fixtures.past.maximum(:updated_at) end @past_events = EventsPresenter.new(@past_fixture_events).events.reverse @past_events_cache = @division_cache_prefix + "team/#{@team.id}/past_events/#{@past_events.size}-#{maximum_updated_at.to_i}" # for marketing popup team dropdown unless @division.nil? @teams_json = Rabl.render(@division_presenter.teams, "api/v1/teams/show_faft_micro", view_path: 'app/views', :formats => [:json], :handlers => [:rabl]).html_safe end render 'show_public', :layout => 'app_public' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend", "def profile\n @user = @current_user\n\n render :show\n\n end", "def profile\n @shop = Shop.find(1)\n render :template => 'facebook/profile.erb', :layout => false\n ...
[ "0.7709028", "0.71468854", "0.7119228", "0.7060349", "0.7033308", "0.70112", "0.6989668", "0.6959988", "0.6868407", "0.68655455", "0.67868954", "0.67603606", "0.67493266", "0.67391175", "0.67136323", "0.667757", "0.6676071", "0.6668512", "0.6641063", "0.66336966", "0.66178507...
0.0
-1
Recursive function that will be called for each child page (subfolder)
def import_page(path, parent) slug = path.split("/").last # setting page record page = if parent.present? child = site.pages.where(slug: slug).first_or_initialize child.parent = parent child else site.pages.root || site.pages.new(slug: slug) end content_path = File.join(path, "content.html") # If file is newer than page record we'll process it if fresh_seed?(page, content_path) # reading file content in, resulting in a hash fragments_hash = parse_file_content(content_path) # parsing attributes section attributes_yaml = fragments_hash.delete("attributes") attrs = YAML.safe_load(attributes_yaml) # applying attributes layout = site.layouts.find_by(identifier: attrs.delete("layout")) || parent.try(:layout) category_ids = category_names_to_ids(page, attrs.delete("categories")) target_page = attrs.delete("target_page") page.attributes = attrs.merge( layout: layout, category_ids: category_ids ) # applying fragments old_frag_identifiers = page.fragments.pluck(:identifier) new_frag_identifiers, fragments_attributes = construct_fragments_attributes(fragments_hash, page, path) page.fragments_attributes = fragments_attributes if page.save message = "[CMS SEEDS] Imported Page \t #{page.full_path}" ComfortableMexicanSofa.logger.info(message) # defering target page linking if target_page.present? self.target_pages ||= {} self.target_pages[page.id] = target_page end # cleaning up old fragments page.fragments.where(identifier: old_frag_identifiers - new_frag_identifiers).destroy_all else message = "[CMS SEEDS] Failed to import Page \n#{page.errors.inspect}" ComfortableMexicanSofa.logger.warn(message) end end import_translations(path, page) # Tracking what page from seeds we're working with. So we can remove pages # that are no longer in seeds seed_ids << page.id # importing child pages (if there are any) Dir["#{path}*/"].each do |page_path| import_page(page_path, page) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_subpages(dir, parent_page)\n\t\tmarkdown_files_in(dir) do |subpage|\n\n\t\t\tsubpage_path = File.basename(subpage)\n\t\t\tsubpage_info = split_info(subpage_path)\n\t\t\t\n\t\t\t# if parsable file name\n\t\t\tif subpage_info\n\t\t\t\t# file = IO.read(File.join(dir, subpage_path))\n\t\t\t\tfile = FrontMa...
[ "0.68303376", "0.67377526", "0.6663272", "0.6493114", "0.63488424", "0.63262385", "0.6288872", "0.62853926", "0.6241335", "0.624092", "0.61820525", "0.61731386", "0.6112671", "0.6099957", "0.60779923", "0.6066818", "0.60621154", "0.60349524", "0.6033656", "0.6017414", "0.6007...
0.0
-1
Importing translations for given page. They look like `content.locale.html`
def import_translations(path, page) old_translations = page.translations.pluck(:locale) new_translations = [] Dir["#{path}content.*.html"].each do |file_path| locale = File.basename(file_path).match(%r{content\.(\w+)\.html})[1] new_translations << locale translation = page.translations.where(locale: locale).first_or_initialize next unless fresh_seed?(translation, file_path) # reading file content in, resulting in a hash fragments_hash = parse_file_content(file_path) # parsing attributes section attributes_yaml = fragments_hash.delete("attributes") attrs = YAML.safe_load(attributes_yaml) # applying attributes layout = site.layouts.find_by(identifier: attrs.delete("layout")) || page.try(:layout) translation.attributes = attrs.merge( layout: layout ) # applying fragments old_frag_identifiers = translation.fragments.pluck(:identifier) new_frag_identifiers, fragments_attributes = construct_fragments_attributes(fragments_hash, translation, path) translation.fragments_attributes = fragments_attributes if translation.save message = "[CMS SEEDS] Imported Translation \t #{locale}" ComfortableMexicanSofa.logger.info(message) # cleaning up old fragments frags_to_remove = old_frag_identifiers - new_frag_identifiers translation.fragments.where(identifier: frags_to_remove).destroy_all else message = "[CMS SEEDS] Failed to import Translation \n#{locale}" ComfortableMexicanSofa.logger.warn(message) end end # Cleaning up removed translations translations_to_remove = old_translations - new_translations page.translations.where(locale: translations_to_remove).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i18n\n %w(en es).each do |locale|\n copy_file \"i18n.#{ locale }.yml\", \"config/locales/seo_landing_pages.#{ locale }.yml\"\n end\n end", "def seed_page_content_translations!\n I18n.available_locales.each do |locale|\n seed_content_for_locale locale.to_s\n end\n end",...
[ "0.66005903", "0.6434012", "0.6153062", "0.6153062", "0.60005456", "0.60005456", "0.5946621", "0.59438527", "0.59423167", "0.58755416", "0.5845026", "0.58390385", "0.57943356", "0.5731144", "0.57250303", "0.57180715", "0.57020986", "0.5696444", "0.56761223", "0.5607724", "0.5...
0.75523263
0
Constructing frag attributes hash that can be assigned to page or translation also returning list of frag identifiers so we can destroy old ones
def construct_fragments_attributes(hash, record, path) frag_identifiers = [] frag_attributes = hash.collect do |frag_header, frag_content| tag, identifier = frag_header.split frag_hash = { identifier: identifier, tag: tag } # tracking fragments that need removing later frag_identifiers << identifier # based on tag we need to cram content in proper place and proper format case tag when "date", "datetime" frag_hash[:datetime] = frag_content when "checkbox" frag_hash[:boolean] = frag_content when "file", "files" files, file_ids_destroy = files_content(record, identifier, path, frag_content) frag_hash[:files] = files frag_hash[:file_ids_destroy] = file_ids_destroy else frag_hash[:content] = frag_content end frag_hash end [frag_identifiers, frag_attributes] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend", "def hash\n [anchor_allow_white_space_in_characters, anchor_allow_white_space_in_characters_metadata, anchor_case_sensitive, anchor_case_sensitive_metadata, anchor_horizontal_alignment, anchor_ho...
[ "0.56959295", "0.5492727", "0.5431907", "0.54316825", "0.52419615", "0.5200731", "0.51992965", "0.51354253", "0.5129367", "0.5119489", "0.51079667", "0.5104444", "0.5085642", "0.5038109", "0.5033512", "0.5024392", "0.5009743", "0.50096923", "0.4981868", "0.49810797", "0.49733...
0.7121471
0
Preparing fragment attachments. Returns hashes with file data for ActiveStorage and a list of ids of old attachements to destroy
def files_content(record, identifier, path, frag_content) # preparing attachments files = frag_content.split("\n").collect do |filename| file_handler = File.open(File.join(path, filename)) { io: file_handler, filename: filename, content_type: MimeMagic.by_magic(file_handler) } end # ensuring that old attachments get removed ids_destroy = [] if (frag = record.fragments.find_by(identifier: identifier)) ids_destroy = frag.attachments.pluck(:id) end [files, ids_destroy] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_fragments_attributes(hash, record, path)\n frag_identifiers = []\n frag_attributes = hash.collect do |frag_header, frag_content|\n tag, identifier = frag_header.split\n frag_hash = {\n identifier: identifier,\n tag: tag\n }\n\n # tracking...
[ "0.5711943", "0.5473956", "0.5419085", "0.5418018", "0.54128456", "0.5406729", "0.5288619", "0.526177", "0.5248263", "0.5184201", "0.51345015", "0.5119709", "0.50968635", "0.50938916", "0.5088327", "0.5069423", "0.50668746", "0.5064317", "0.50563747", "0.50323266", "0.502208"...
0.60471237
0
TCP_NODELAY is set to disable buffering. In the case of Sanford communication, we have all the information we need to send up front and are closing the connection, so it doesn't need to buffer. See
def tcp_socket TCPSocket.new(host, port).tap do |socket| socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodelay\n ensure_state :connected\n @socket.getsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY).int.nonzero?\n end", "def nodelay=(flag)\n ensure_state :connected\n @socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, flag ? 1 : 0)\n end", "def configu...
[ "0.7306909", "0.7205355", "0.6943036", "0.61867565", "0.589238", "0.58373284", "0.57976645", "0.5772798", "0.5723468", "0.5629482", "0.5627005", "0.5604623", "0.5600186", "0.5567009", "0.55201966", "0.542904", "0.53926086", "0.53926086", "0.5392193", "0.5371687", "0.53661156"...
0.6704016
3
Public Override inspect to display vm attributes
def inspect state_provider = "[#{box_state} (#{provider})]" "#{name.ljust(max_length)} #{state_provider.ljust(max_length)} [VM OS <-- #{guest_os}]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info()\n super(VM_METHODS[:info], 'VM')\n end", "def info(decrypt = false)\n super(VM_METHODS[:info], 'VM', decrypt)\n end", "def inspect\n vals = ATTRS.map { |field| \"#{field}: #{public_send(field).inspect}\" }\n \"#<#{self.class.name} #{vals.join(', ')}>\"\n...
[ "0.7034613", "0.683053", "0.6475023", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.64200974", "0.63720167", "0.6364082", "0.63441926", "...
0.59483683
71
callseq: shim[index] => value Returns the _value_ at the given _index_. The array shim applies it's offset to the _index_ before retrieving the value.
def []( index ) @ary.at(index + @offset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_index(index)\n @arr[index]\n end", "def at(index)\n \t@array[index]\n end", "def at( index )\r\n @ary.at(index + @offset)\r\n end", "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def at(index)\n each.with_index { |v, i| return v ...
[ "0.6705164", "0.6573022", "0.64711934", "0.6421656", "0.6329272", "0.62882257", "0.6282665", "0.6282665", "0.62565213", "0.6248689", "0.6170818", "0.6129213", "0.60942155", "0.60735285", "0.60180324", "0.60075724", "0.6007493", "0.600637", "0.60061693", "0.5991592", "0.599047...
0.61637765
11
callseq: shim[index] = value Sets the _value_ at the given _index_. The array shim applies it's offset to the _index_ before setting the _value_.
def []=( index, value ) @ary[index + @offset] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(index, value)\n set(index, value)\n end", "def []=(index, value)\n end", "def set(index, val)\n \n end", "def []=(indx, value)\n elements[indx] = value\n end", "def []=(index, value)\n %x{\n var size = #{self}.length;\n\n if (index < 0) {\n index += ...
[ "0.7118109", "0.7027778", "0.70017946", "0.69859034", "0.692407", "0.692382", "0.68966824", "0.68679464", "0.676832", "0.6716316", "0.65789926", "0.65663934", "0.65489966", "0.6540345", "0.6508133", "0.64684135", "0.6463302", "0.6429215", "0.6403789", "0.63974446", "0.6350883...
0.71751994
0
callseq: at( index ) => value
def at( index ) @ary.at(index + @offset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at(index); end", "def [](index)\n\t\t@sequence[index]\n\tend", "def [](index); end", "def [](index)\n @val[index]\n end", "def at(index)\n self[index]\n end", "def at(index)\n \t@array[index]\n end", "def at(array, i)\n array[i]\nend", "def [](index)\n @values[index]\n end", ...
[ "0.8371274", "0.77391016", "0.77143025", "0.7711922", "0.7490549", "0.7483831", "0.7396486", "0.736687", "0.7365812", "0.7323467", "0.7322493", "0.72951317", "0.7289671", "0.7289671", "0.7273964", "0.7267843", "0.7255149", "0.7251651", "0.72453475", "0.7222895", "0.7198048", ...
0.7253818
17
Cheat to access a different controller
def wrap_with_controller(new_controller = Kaui::SessionsController) old_controller = @controller @controller = new_controller.new yield @controller = old_controller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller(controller); end", "def controller\n end", "def controller\n end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; ...
[ "0.762625", "0.74495393", "0.74495393", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.73517007", "0.7047888", "0.6879396", "0.67930865", "0.6758461", "0.6757817", "0.6757817", "0.6733979", "0.6...
0.0
-1
Use callbacks to share common setup or constraints between actions. def set_story
def story_params params.require(:story).permit(:title, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_story\n @story = Story.find(params[:story_id])\n end", "def set_story\n @story = Story.find(params[:id])\n end", "def set_story\n @story = Story.find(params[:id])\n end", "def set_story\n @story = Story.find(params[:id])\n end", "def set_story\n @story = Story.find(...
[ "0.6911114", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.68065214", "0.67642146",...
0.0
-1
Stub implementation for logging errors. By default, this function does nothing if the debug flag has not been set with setDebug. Otherwise, it tries to write the SDK error message to the file that is specified.
def debug(error) return if @debug.nil? or @debug.empty? begin File.open(@debug, "a"){|f| f.puts(error)} rescue warn("Error: debug: Failed to open #{@debug} for logging.") end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(msg); @logger.error(msg); end", "def setup_logging_stubs(_error = nil, _code = nil, _message = nil)\n _undefined\n end", "def log_error(message)\n logger.error(message) if logger && logger.error?\n end", "def stub_log_error\n ExceptionHandling.stub_handler = self\n end", "def erro...
[ "0.6555185", "0.6437822", "0.63784707", "0.6335859", "0.6260127", "0.624371", "0.619346", "0.6184484", "0.61614674", "0.6145898", "0.61324054", "0.6118624", "0.6076368", "0.60682285", "0.60328007", "0.6023618", "0.60207313", "0.60207313", "0.60207313", "0.6019323", "0.6010924...
0.62974066
4
Stub implementation for handling a fatal error.
def fatal(error) debug(error) raise(error) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fatal; end", "def fatal?; end", "def fatal?; end", "def fatal_error(message)\n puts message\n exit -1\nend", "def fatal_error(error)\n $stderr.puts \"#{$0}: error: #{error}\"\n exit 1\nend", "def fatal(*args)\n log(*args)\n fail_now\n end", "def fatal!(msg, err = -1)\n Kitchen...
[ "0.75036377", "0.7105579", "0.7105579", "0.69429165", "0.6875266", "0.6585203", "0.64592505", "0.6421875", "0.64035183", "0.637629", "0.6262025", "0.6255522", "0.62370545", "0.62268084", "0.6222055", "0.61333984", "0.61333984", "0.6021644", "0.60121095", "0.60051686", "0.5996...
0.66950274
5
Initialize the WindowsLiveLogin module with the application ID, secret key, and security algorithm. We recommend that you employ strong measures to protect the secret key. The secret key should never be exposed to the Web or other users. Be aware that if you do not supply these settings at initialization time, you may need to set the corresponding properties manually.
def initialize(appid=nil, secret=nil, securityalgorithm=nil) self.appid = appid if appid self.secret = secret if secret self.securityalgorithm = securityalgorithm if securityalgorithm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(config_file=CONFIG_FILE)\n confs = YAML.load_file(config_file)['windows_live']\n @wll = WindowsLiveLogin.new(confs['appid'], confs['secret'], confs['security_algorithm'],\n nil, confs['policy_url'], confs['return_url'])\n end", "def initialize(site_key...
[ "0.6391889", "0.6072822", "0.58830136", "0.5791015", "0.5763441", "0.57166785", "0.5680368", "0.5667496", "0.5651198", "0.5635684", "0.56341505", "0.5616238", "0.55980647", "0.5581414", "0.55349207", "0.55346906", "0.55217296", "0.55135465", "0.55135465", "0.55086654", "0.550...
0.6196991
1