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 |
|---|---|---|---|---|---|---|
Define a detail table within this block | def table_detail(name, &block)
add_table(Schema::TableDef.detail(name, *get_table_contents(&block)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Detail(*args)\n Stupidedi::Schema::TableDef.detail(*args)\n end",
"def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end",
"def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end",
"def errata_details... | [
"0.71946937",
"0.6208278",
"0.60590106",
"0.60045964",
"0.59798783",
"0.5951835",
"0.59015447",
"0.5887548",
"0.5868267",
"0.58515126",
"0.58515126",
"0.58515126",
"0.58515126",
"0.58164597",
"0.57779473",
"0.5773893",
"0.57581127",
"0.5754078",
"0.57122517",
"0.56928617",
"0... | 0.8069678 | 0 |
Helper method to get the body of a table. | def get_table_contents(&block)
TableBodyDSL.new(&block).elements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_table_body\n body =\n if data.column_names && !data.column_names.empty?\n data\n else\n data[1..-1]\n end\n body.each { |row| build_md_row(output, row) }\n end",
"def getBody\n body = \"\"\n @body.each { |part| body << pa... | [
"0.6657287",
"0.664719",
"0.6508801",
"0.6288299",
"0.6236229",
"0.6192759",
"0.6166936",
"0.6166936",
"0.6166936",
"0.6166936",
"0.61625594",
"0.61396456",
"0.61246705",
"0.6076583",
"0.6069553",
"0.60604113",
"0.60521275",
"0.6040449",
"0.60200953",
"0.60197496",
"0.600214"... | 0.76764774 | 0 |
Redirect user to his Wallet after sign in. | def after_sign_in_path_for(_resource)
wallet_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def myaccount\n redirect_to user_path(current_user)\n end",
"def auth_merchant\n unless session[:merchant]\n session[:flash] = 'You must be signed in as a merchant to see that page.'\n redirect '/home'\n end\n end",
"def redirect_to_appropriate_page_after_sign_in\n if params[:... | [
"0.69162583",
"0.6817183",
"0.6811521",
"0.674324",
"0.67364705",
"0.667443",
"0.6668492",
"0.66360486",
"0.65567774",
"0.65418375",
"0.65079653",
"0.64850676",
"0.64736164",
"0.64448994",
"0.644393",
"0.6439262",
"0.643722",
"0.64347225",
"0.6421766",
"0.64082235",
"0.640568... | 0.7087828 | 0 |
run before each test | def setup
post '/login', :fb_access_token => FB_ACCESS_TOKEN
assert last_response.ok?
# puts "[TEST] -- " + last_response.body
hash = JSON.parse(last_response.body)
assert hash.key? "token"
assert hash.key? "signup"
assert hash["signup"] == "false" or hash["signup"] == "true"
assert hash["token"].class == String and hash["token"].length > 0
@@token = hash["token"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_test(test); end",
"def before_test(test); end",
"def before_run; end",
"def setup(&block)\n before(:each, &block)\n end",
"def before() ; end",
"def before_load(test_files); end",
"def before\n end",
"def before_setup\n # do nothing by default\n end",
"def before... | [
"0.82351017",
"0.82351017",
"0.76814866",
"0.7639122",
"0.7629674",
"0.75388706",
"0.7496993",
"0.74213463",
"0.7385754",
"0.7370279",
"0.73371637",
"0.7264006",
"0.7241065",
"0.7082588",
"0.705766",
"0.7043837",
"0.69815123",
"0.69188714",
"0.69150245",
"0.6827504",
"0.68100... | 0.0 | -1 |
Method that makes sure the user is logged in for use by the controllers | def login_required
redirect_to(root_url, notice: 'You have to be signed in to do that! Top right ~') unless current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_logged_in\n login! if @user.nil?\n end",
"def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end",
"def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"def logged_in_user\n unle... | [
"0.84166217",
"0.806106",
"0.79494333",
"0.7934371",
"0.79318875",
"0.79307926",
"0.7900756",
"0.78930604",
"0.7892072",
"0.7889504",
"0.78642887",
"0.7826432",
"0.7816049",
"0.7813456",
"0.7807877",
"0.7806371",
"0.7804812",
"0.7800882",
"0.7791033",
"0.7787481",
"0.77740157... | 0.0 | -1 |
The user currently signed in | def current_user
@current_user || User.find(session[:user_id]) if session[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.h... | [
"0.81421703",
"0.81421703",
"0.8052077",
"0.8049851",
"0.8049851",
"0.80281913",
"0.8006701",
"0.79613626",
"0.7924824",
"0.7923788",
"0.7917168",
"0.79129726",
"0.79129726",
"0.7898757",
"0.78116935",
"0.7807642",
"0.7797764",
"0.7791238",
"0.77678925",
"0.775836",
"0.774379... | 0.74412286 | 83 |
Rejects the given message from Disque by +id+. Currently a noop | def reject(id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject(message_id)\n raise NotImplementedError\n end",
"def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end",
"def reject!\n raise RejectMessage\n end",
"def expire_message(id)\n with_queue_control do |control|\n... | [
"0.800589",
"0.6852942",
"0.6639905",
"0.6572045",
"0.6446235",
"0.6437023",
"0.6437023",
"0.6135353",
"0.60458314",
"0.6044311",
"0.6044311",
"0.6019956",
"0.5985151",
"0.5957664",
"0.5941873",
"0.5881662",
"0.58583707",
"0.5814231",
"0.57987964",
"0.5798356",
"0.5760043",
... | 0.71980435 | 1 |
Deletes the given message from Disque by +id+ | def complete(id)
Chore.logger.debug "Completing (deleting): #{id}"
disque.call("ACKJOB",id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end",
"def delete_message(queue_name... | [
"0.7996087",
"0.7952814",
"0.770677",
"0.75424755",
"0.75302315",
"0.7505173",
"0.7501736",
"0.7478509",
"0.7412752",
"0.7400998",
"0.73637086",
"0.73344487",
"0.73344487",
"0.71860486",
"0.7152041",
"0.7152041",
"0.71073204",
"0.70767397",
"0.70720947",
"0.70710963",
"0.7055... | 0.0 | -1 |
Requests messages from Disque, and invokes the provided +&block+ over each one. Afterwards, the :on_fetch hook will be invoked, per message | def handle_messages
messages = *disque.fetch(from: queue_name,timeout: 100,count: batch_size)
messages.each do |queue,id,data|
Chore.logger.debug "Received #{id.inspect} from #{queue.inspect} with #{data.inspect}"
yield(id, queue, nil, data, 0)
Chore.run_hooks_for(:on_fetch, id, data)
end
messages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_messages\n if !@worker_pool.worker_available? && @state.run?\n @worker_available.wait\n end\n return unless @worker_pool.worker_available? && @state.run?\n\n begin\n args = [self.signals_redis_key, self.queue_redis_keys.shuffle, 0].flatten\n redis_ke... | [
"0.69078225",
"0.6903522",
"0.6775698",
"0.67391837",
"0.64720213",
"0.6442259",
"0.640556",
"0.6258295",
"0.6236923",
"0.61560047",
"0.61388147",
"0.6063627",
"0.6063076",
"0.6038553",
"0.60208476",
"0.6008124",
"0.5981896",
"0.5970409",
"0.5935726",
"0.59307134",
"0.5919214... | 0.7694741 | 0 |
Overrides const_missing in ActiveSupport::Dependencies | def const_missing(const_name)
filename = const_name.to_s.underscore
dirs = [nil] + (@autoload_without_namespacing_dirs || [])
dirs.each do |dir|
filepath = path.join(*([dir, "#{filename}.rb"].compact))
if File.exists? filepath
load filepath.to_s
return const_get(const_name)
end
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def const_missing(const); end",
"def const_missing(cons)\n load_const(cons) || super\n end",
"def const_missing(symbol)\n # final implementation in delta/Module.rb , this implementation avoids MNU\n # while constructing the exception\n raise NameError, 'uninitialized constant during boot... | [
"0.78414845",
"0.7687728",
"0.7600606",
"0.7285046",
"0.71888804",
"0.703996",
"0.6954545",
"0.6954545",
"0.6902378",
"0.66124964",
"0.6603499",
"0.64331317",
"0.6420216",
"0.6336713",
"0.627642",
"0.62687254",
"0.62305385",
"0.6207307",
"0.61590725",
"0.612017",
"0.611862",
... | 0.68417704 | 9 |
State transition tables end reduce 0 omitted | def _reduce_1(val, _values, result)
self.lexer.lex_state = :expr_beg
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transitions; end",
"def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n... | [
"0.64084065",
"0.60676664",
"0.6042078",
"0.6010546",
"0.59501565",
"0.5937538",
"0.5937538",
"0.5911722",
"0.58912516",
"0.5869813",
"0.5869813",
"0.5783439",
"0.57825816",
"0.5712383",
"0.5698408",
"0.56560355",
"0.55742663",
"0.5505388",
"0.549196",
"0.5483834",
"0.5443691... | 0.0 | -1 |
reduce 4 omitted reduce 5 omitted | def _reduce_6(val, _values, result)
result = self.block_append val[0], val[2]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_555(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_612(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_76(val, _values, result); end",
"def _reduce_76(val, _values, result); en... | [
"0.6742373",
"0.65648335",
"0.654707",
"0.654707",
"0.6541003",
"0.6525085",
"0.6525085",
"0.6521839",
"0.6508959",
"0.64965284",
"0.64932734",
"0.6476861",
"0.6471889",
"0.64710945",
"0.64710945",
"0.64671123",
"0.6461539",
"0.64605373",
"0.6456827",
"0.6451995",
"0.6449653"... | 0.0 | -1 |
reduce 13 omitted reduce 14 omitted | def _reduce_15(val, _values, result)
result = self.block_append val[0], val[2]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_13(val, _values, result); end",
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_612(val, _values, result)\n ... | [
"0.71051943",
"0.66943073",
"0.66871536",
"0.666146",
"0.6659532",
"0.6659532",
"0.6639964",
"0.6634204",
"0.6625384",
"0.6612673",
"0.6612673",
"0.6604862",
"0.660372",
"0.660372",
"0.6600507",
"0.65962356",
"0.6593521",
"0.656864",
"0.656864",
"0.6563033",
"0.65618736",
"... | 0.0 | -1 |
reduce 50 omitted reduce 51 omitted reduce 52 omitted | def _reduce_53(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_50(val, _values, result); end",
"def _reduce_50(val, _values, result); end",
"def _reduce_498(val, _values, result)\n result = nil\n\n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n \n result\nend",
"def _redu... | [
"0.7231666",
"0.7231666",
"0.705069",
"0.698978",
"0.69892716",
"0.6960059",
"0.6960059",
"0.6946955",
"0.6946955",
"0.6919635",
"0.6919635",
"0.6895957",
"0.68615067",
"0.68517286",
"0.68404305",
"0.6838037",
"0.6820792",
"0.68158424",
"0.6803077",
"0.6796269",
"0.678944",
... | 0.0 | -1 |
reduce 112 omitted reduce 113 omitted reduce 114 omitted | def _reduce_115(val, _values, result)
lexer.lex_state = :expr_end
result = val[0]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_712(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_603(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n result = nil\n ... | [
"0.72265005",
"0.7170951",
"0.716597",
"0.7154069",
"0.7154069",
"0.71459264",
"0.71373004",
"0.7094069",
"0.7092341",
"0.7077224",
"0.706671",
"0.7050284",
"0.7045181",
"0.70373964",
"0.7025315",
"0.70251524",
"0.69952476",
"0.69952476",
"0.69868696",
"0.6986623",
"0.6981608... | 0.0 | -1 |
reduce 117 omitted reduce 118 omitted | def _reduce_119(val, _values, result)
result = s(:lit, val[0].to_sym)
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_603(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_712(val, _values, result)\n result = nil\n ... | [
"0.75232965",
"0.7501169",
"0.74861604",
"0.74763745",
"0.74594957",
"0.7454648",
"0.7454648",
"0.7452275",
"0.7448948",
"0.74446094",
"0.7437094",
"0.74164826",
"0.74164826",
"0.7414841",
"0.7404361",
"0.7404354",
"0.7397454",
"0.73704857",
"0.7363599",
"0.7361894",
"0.73600... | 0.0 | -1 |
reduce 124 omitted reduce 125 omitted reduce 126 omitted reduce 127 omitted reduce 128 omitted reduce 129 omitted reduce 130 omitted reduce 131 omitted reduce 132 omitted reduce 133 omitted reduce 134 omitted reduce 135 omitted reduce 136 omitted reduce 137 omitted reduce 138 omitted reduce 139 omitted reduce 140 omitted reduce 141 omitted reduce 142 omitted reduce 143 omitted reduce 144 omitted reduce 145 omitted reduce 146 omitted reduce 147 omitted reduce 148 omitted reduce 149 omitted reduce 150 omitted reduce 151 omitted reduce 152 omitted reduce 153 omitted reduce 154 omitted reduce 155 omitted reduce 156 omitted reduce 157 omitted reduce 158 omitted reduce 159 omitted reduce 160 omitted reduce 161 omitted reduce 162 omitted reduce 163 omitted reduce 164 omitted reduce 165 omitted reduce 166 omitted reduce 167 omitted reduce 168 omitted reduce 169 omitted reduce 170 omitted reduce 171 omitted reduce 172 omitted reduce 173 omitted reduce 174 omitted reduce 175 omitted reduce 176 omitted reduce 177 omitted reduce 178 omitted reduce 179 omitted reduce 180 omitted reduce 181 omitted reduce 182 omitted reduce 183 omitted reduce 184 omitted reduce 185 omitted reduce 186 omitted reduce 187 omitted reduce 188 omitted reduce 189 omitted reduce 190 omitted reduce 191 omitted reduce 192 omitted reduce 193 omitted reduce 194 omitted | def _reduce_195(val, _values, result)
result = self.node_assign val[0], val[2]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend",
"def _r... | [
"0.6616659",
"0.66100466",
"0.6526546",
"0.6508378",
"0.6508334",
"0.64766103",
"0.6431587",
"0.6420798",
"0.6404854",
"0.6399095",
"0.6384511",
"0.6384511",
"0.6379424",
"0.6367626",
"0.6357865",
"0.6354676",
"0.6301983",
"0.6301983",
"0.6301983",
"0.6301983",
"0.6293625",
... | 0.0 | -1 |
reduce 245 omitted reduce 246 omitted | def _reduce_247(val, _values, result)
result = val[0]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_555(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_240(val, _values, result); end",
"def _reduce_240(val, _values, result); end",
"def _reduce_605(val, _values, result)\n result = nil\n \n result\n... | [
"0.7197583",
"0.7119136",
"0.7119136",
"0.7059211",
"0.703871",
"0.70321167",
"0.70061857",
"0.70061857",
"0.6989519",
"0.6969411",
"0.69565684",
"0.69565684",
"0.6954753",
"0.6954753",
"0.69323236",
"0.69178504",
"0.69175476",
"0.69124126",
"0.6895392",
"0.6888817",
"0.68813... | 0.0 | -1 |
reduce 271 omitted reduce 272 omitted reduce 273 omitted reduce 274 omitted reduce 275 omitted reduce 276 omitted reduce 277 omitted reduce 278 omitted reduce 279 omitted reduce 280 omitted | def _reduce_281(val, _values, result)
result = new_call nil, val[0].to_sym
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_496(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_228(val, _values, result)\n result = nil\n ... | [
"0.69736433",
"0.69337165",
"0.6847487",
"0.6847487",
"0.68443084",
"0.68207353",
"0.68201065",
"0.6811732",
"0.678102",
"0.6779589",
"0.676876",
"0.67622685",
"0.6739664",
"0.6737672",
"0.6737672",
"0.6729647",
"0.6722902",
"0.6722902",
"0.6720177",
"0.67126846",
"0.6704422"... | 0.0 | -1 |
reduce 336 omitted reduce 337 omitted reduce 338 omitted reduce 339 omitted reduce 340 omitted reduce 341 omitted reduce 342 omitted reduce 343 omitted reduce 344 omitted reduce 345 omitted reduce 346 omitted reduce 347 omitted reduce 348 omitted reduce 349 omitted reduce 350 omitted reduce 351 omitted reduce 352 omitted | def _reduce_353(val, _values, result)
result = s(:if, val[1], val[3], val[4])
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n yyerrok\n \... | [
"0.7155236",
"0.7138998",
"0.71059245",
"0.7096734",
"0.7073417",
"0.70703745",
"0.7036571",
"0.70155495",
"0.7011706",
"0.6990004",
"0.6988552",
"0.69740784",
"0.6967309",
"0.69647765",
"0.6949624",
"0.6949624",
"0.6933186",
"0.69201475",
"0.6911285",
"0.6911285",
"0.6902268... | 0.0 | -1 |
reduce 434 omitted reduce 435 omitted | def _reduce_436(val, _values, result)
_, klasses, var, _, body, rest = val
klasses ||= s(:array)
klasses << node_assign(var, s(:gvar, :"$!")) if var
result = new_resbody(klasses, body)
result << rest if rest # UGH, rewritten above
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_496(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_464(val, _values, result); end",
"def _reduce_712(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_603(val, _values, resul... | [
"0.759136",
"0.7579188",
"0.7567886",
"0.7566111",
"0.75584143",
"0.75377554",
"0.7525751",
"0.7525751",
"0.75143796",
"0.7504288",
"0.7489042",
"0.7489042",
"0.7484525",
"0.74828297",
"0.7475375",
"0.746331",
"0.746331",
"0.7462261",
"0.7460121",
"0.746",
"0.7438914",
"0.7... | 0.0 | -1 |
reduce 439 omitted reduce 440 omitted | def _reduce_441(val, _values, result)
result = val[1]
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_263(val, _values, result); end",
"def _reduce_263(val, _values, result); end",
"def _reduce_496(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_528(val, _values, result); end",
"def _reduce_528(val, _values, result); end",
"def _... | [
"0.7318141",
"0.7318141",
"0.72657365",
"0.72331595",
"0.72331595",
"0.72324485",
"0.72049356",
"0.718821",
"0.7158881",
"0.71493804",
"0.71412146",
"0.7135173",
"0.7127526",
"0.71236885",
"0.71194124",
"0.7115596",
"0.7112772",
"0.7110957",
"0.7107176",
"0.710084",
"0.709933... | 0.0 | -1 |
reduce 491 omitted reduce 492 omitted reduce 493 omitted reduce 494 omitted | def _reduce_495(val, _values, result)
lexer.lex_state = :expr_end
result = val[1]
result ||= s(:str, "")
case result[0]
when :dstr then
result[0] = :dsym
when :str then
result = s(:lit, result.last.to_sym)
when :evstr then
result = s(:dsym, "", result)
else
debug20 26, val, result
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_496(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_527(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_712(val, _values, result)\n result = nil\n ... | [
"0.7497121",
"0.7465954",
"0.7464585",
"0.746379",
"0.7462576",
"0.7440605",
"0.73608154",
"0.7360794",
"0.7360484",
"0.73535067",
"0.7353127",
"0.7353127",
"0.73506224",
"0.73506224",
"0.73475313",
"0.7340303",
"0.7337883",
"0.7334167",
"0.7302861",
"0.73027885",
"0.72954136... | 0.0 | -1 |
reduce 498 omitted reduce 499 omitted reduce 500 omitted reduce 501 omitted reduce 502 omitted reduce 503 omitted reduce 504 omitted reduce 505 omitted reduce 506 omitted | def _reduce_507(val, _values, result)
result = s(:nil)
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_502(val, _values, result); end",
"def _reduce_502(val, _values, result); end",
"def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_400(val, _values, result); end",
"def _reduce_599(val, _values, result)\n r... | [
"0.7322251",
"0.7322251",
"0.7254511",
"0.6909827",
"0.6875899",
"0.68503827",
"0.6829991",
"0.68267787",
"0.6808774",
"0.6808774",
"0.6775864",
"0.6775864",
"0.6766035",
"0.67634255",
"0.6761072",
"0.6760876",
"0.6757709",
"0.6740825",
"0.6739196",
"0.67302394",
"0.67259073"... | 0.0 | -1 |
reduce 566 omitted reduce 567 omitted | def _reduce_568(val, _values, result)
result = :"**#{val[1]}"
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_603(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_605(val, _values, result)\n result = nil\n ... | [
"0.7628393",
"0.76000744",
"0.75845754",
"0.75534034",
"0.7552444",
"0.7549268",
"0.7548861",
"0.7547164",
"0.754557",
"0.7492524",
"0.7473921",
"0.747368",
"0.74718845",
"0.74718845",
"0.7457036",
"0.74424094",
"0.74361986",
"0.743121",
"0.7421748",
"0.74198383",
"0.7419802"... | 0.0 | -1 |
reduce 576 omitted reduce 577 omitted | def _reduce_578(val, _values, result)
# TODO: differs from parse.y - needs tests
name = val[1].to_sym
self.assignable name
result = :"*#{name}"
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_527(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_496(val, _values, result)\n result = nil\n ... | [
"0.73855805",
"0.7358932",
"0.7352497",
"0.73482543",
"0.7341048",
"0.73365885",
"0.7334779",
"0.7321376",
"0.7321376",
"0.7244694",
"0.7237158",
"0.7224809",
"0.72218376",
"0.72193474",
"0.72172743",
"0.72162837",
"0.72072524",
"0.720163",
"0.720163",
"0.72014016",
"0.719653... | 0.0 | -1 |
reduce 580 omitted reduce 581 omitted | def _reduce_582(val, _values, result)
identifier = val[1].to_sym
self.env[identifier] = :lvar
result = "&#{identifier}".to_sym
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_496(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_498(val, _values, result)\n result = nil\n\n re... | [
"0.7379507",
"0.7302435",
"0.7278631",
"0.7255415",
"0.72427636",
"0.72369546",
"0.72125167",
"0.720557",
"0.719817",
"0.71960294",
"0.7173395",
"0.7173395",
"0.7169118",
"0.7169118",
"0.71657115",
"0.7154804",
"0.715317",
"0.714069",
"0.7136643",
"0.7133641",
"0.71217906",
... | 0.0 | -1 |
reduce 595 omitted reduce 596 omitted reduce 597 omitted reduce 598 omitted reduce 599 omitted reduce 600 omitted reduce 601 omitted reduce 602 omitted reduce 603 omitted reduce 604 omitted reduce 605 omitted reduce 606 omitted reduce 607 omitted reduce 608 omitted reduce 609 omitted reduce 610 omitted reduce 611 omitted reduce 612 omitted reduce 613 omitted reduce 614 omitted reduce 615 omitted reduce 616 omitted | def _reduce_617(val, _values, result)
yyerrok
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_596(val, _values, result)\n yyerrok\n \n ... | [
"0.7358291",
"0.7324186",
"0.72733516",
"0.7263323",
"0.7239134",
"0.72341347",
"0.7227797",
"0.72071666",
"0.72063684",
"0.72035825",
"0.72016853",
"0.71912456",
"0.7170202",
"0.7170202",
"0.71635956",
"0.71627694",
"0.7155657",
"0.7144647",
"0.7140034",
"0.7136533",
"0.7136... | 0.0 | -1 |
reduce 618 omitted reduce 619 omitted | def _reduce_620(val, _values, result)
yyerrok
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_608(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_605(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_712(val, _values, result)\n result = nil\n ... | [
"0.74108267",
"0.7369126",
"0.73410857",
"0.7325961",
"0.73259544",
"0.7318676",
"0.72820073",
"0.72643983",
"0.72643983",
"0.72635055",
"0.7263499",
"0.72305703",
"0.72214097",
"0.7219166",
"0.72185034",
"0.719963",
"0.7194578",
"0.7194578",
"0.7193683",
"0.7182935",
"0.7173... | 0.0 | -1 |
=begin include VirtualMonkey::Mysql def lamp_lookup_scripts scripts = [ [ 'backup', 'mysqldump backup' ], [ 'restart_apache', '\(re\)start' ] ] | def run_lamp_chef_checks
# check that the standard unified app is responding on port 80
run_unified_application_checks(@servers, 80)
=begin
# check that running the mysql backup script succeeds
@servers.first.spot_check_command("/etc/cron.daily/mysql-dump-backup.sh")
# exercise operational RightScript(s)
run_script("backup", @servers.first)
run_script("restart_apache", @servers.first)
# check that mysql tmpdir is custom setup on all servers
query = "show variables like 'tmpdir'"
query_command = "echo -e \"#{query}\"| mysql"
@servers.each do |server|
server.spot_check(query_command) { |result| raise "Failure: tmpdir was unset#{result}" unless result.include?("/mnt/mysqltmp") }
end
# check that logrotate has mysqlslow in it
@servers.each do |server|
res = server.spot_check_command("logrotate --force -v /etc/logrotate.d/mysql-server")
raise "LOGROTATE FAILURE, exited with non-zero status" if res[:status] != 0
raise "DID NOT FIND mysqlslow.log in the log rotation!" if res[:output] !~ /mysqlslow/
end
=end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mysql_lookup_scripts\n scripts = [\n [ 'setup_block_device', 'db_mysql::setup_block_device' ],\n [ 'do_backup', 'db_mysql::do_backup' ],\n [ 'do_restore', 'db_mysql::do_restore' ],\n [ 'do_backup_s3', 'db_mysql::do_backup_s3' ],\n ... | [
"0.73496306",
"0.67042524",
"0.66218495",
"0.6444269",
"0.6121604",
"0.58603877",
"0.5687792",
"0.56627494",
"0.5489374",
"0.5485501",
"0.5478333",
"0.5476563",
"0.5436205",
"0.5418783",
"0.53988564",
"0.53374183",
"0.53354925",
"0.5328546",
"0.523103",
"0.52285546",
"0.52207... | 0.56345314 | 8 |
def make_boolean_of(value) return case value when "0" then false when 0 then false when "false" then false when "" then false when nil then false when false then false else true end end | def years_until_retirement
@retirement_age.to_i - @current_age.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end",
"def value_to_boolean(value)\n return value if value==true || value==false\n case value.to_s.downc... | [
"0.86032563",
"0.84568685",
"0.8189269",
"0.81481797",
"0.80217946",
"0.8018257",
"0.7949474",
"0.7927064",
"0.7909389",
"0.7854441",
"0.7844598",
"0.7810019",
"0.78097886",
"0.779544",
"0.7770825",
"0.7743455",
"0.7738595",
"0.772539",
"0.7693493",
"0.76648575",
"0.76487404"... | 0.0 | -1 |
GET /dumb_counters GET /dumb_counters.json | def index
@dumb_counters = DumbCounter.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counters\n @client.fetch(:counters)\n end",
"def set_dumb_counter\n @dumb_counter = DumbCounter.find(params[:id])\n end",
"def create\n @dumb_counter = DumbCounter.new(dumb_counter_params)\n\n respond_to do |format|\n if @dumb_counter.save\n format.html { redirect_to @... | [
"0.66515756",
"0.6477299",
"0.6282563",
"0.6153294",
"0.61349374",
"0.61160886",
"0.60378605",
"0.6011902",
"0.59897715",
"0.5968557",
"0.58897084",
"0.5830793",
"0.58232474",
"0.57857096",
"0.57655084",
"0.5669549",
"0.5618392",
"0.5563526",
"0.5439597",
"0.5428551",
"0.5423... | 0.76268005 | 0 |
GET /dumb_counters/1 GET /dumb_counters/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dumb_counters = DumbCounter.all\n end",
"def set_dumb_counter\n @dumb_counter = DumbCounter.find(params[:id])\n end",
"def counters\n @client.fetch(:counters)\n end",
"def create\n @dumb_counter = DumbCounter.new(dumb_counter_params)\n\n respond_to do |format|\n ... | [
"0.7417674",
"0.6609208",
"0.64206946",
"0.6403401",
"0.6394459",
"0.6372498",
"0.6191856",
"0.60763395",
"0.6031632",
"0.6011964",
"0.5824755",
"0.5811935",
"0.57954776",
"0.57618326",
"0.5724556",
"0.5691525",
"0.56862235",
"0.5541668",
"0.5535541",
"0.55319864",
"0.5498055... | 0.0 | -1 |
POST /dumb_counters POST /dumb_counters.json | def create
@dumb_counter = DumbCounter.new(dumb_counter_params)
respond_to do |format|
if @dumb_counter.save
format.html { redirect_to @dumb_counter, notice: 'Dumb counter was successfully created.' }
format.json { render :show, status: :created, location: @dumb_counter }
else
format.html { render :new }
format.json { render json: @dumb_counter.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dumb_counter_params\n params.require(:dumb_counter).permit(:name, :started_at, :finished_at)\n end",
"def index\n @dumb_counters = DumbCounter.all\n end",
"def set_dumb_counter\n @dumb_counter = DumbCounter.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @d... | [
"0.6727824",
"0.6702547",
"0.6510325",
"0.62721646",
"0.6201028",
"0.60180694",
"0.59349614",
"0.57457626",
"0.5649706",
"0.5632144",
"0.5616216",
"0.5499299",
"0.54211915",
"0.5366438",
"0.53104746",
"0.52962923",
"0.52566695",
"0.52529025",
"0.5221883",
"0.5139332",
"0.5109... | 0.74165195 | 0 |
PATCH/PUT /dumb_counters/1 PATCH/PUT /dumb_counters/1.json | def update
respond_to do |format|
if @dumb_counter.update(dumb_counter_params)
format.html { redirect_to @dumb_counter, notice: 'Dumb counter was successfully updated.' }
format.json { render :show, status: :ok, location: @dumb_counter }
else
format.html { render :edit }
format.json { render json: @dumb_counter.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @counter.update(counter_params)\n format.html { redirect_to @counter, notice: 'Counter was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter }\n else\n format.html { render :edit }\n format.json {... | [
"0.6446974",
"0.6194123",
"0.61668",
"0.61552954",
"0.6147603",
"0.6129726",
"0.6076664",
"0.6076309",
"0.59610254",
"0.5955056",
"0.5935307",
"0.5893828",
"0.5871628",
"0.57044894",
"0.5610542",
"0.5609111",
"0.5581511",
"0.55813843",
"0.55788904",
"0.5575024",
"0.5568819",
... | 0.73376495 | 0 |
DELETE /dumb_counters/1 DELETE /dumb_counters/1.json | def destroy
@dumb_counter.destroy
respond_to do |format|
format.html { redirect_to dumb_counters_url, notice: 'Dumb counter was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @counter.destroy\n respond_to do |format|\n format.html { redirect_to counters_url, notice: 'Counter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-trace... | [
"0.67274326",
"0.6695811",
"0.64432204",
"0.6441358",
"0.63885",
"0.6192047",
"0.6180793",
"0.61796343",
"0.6166595",
"0.6117303",
"0.6099934",
"0.6064777",
"0.60433453",
"0.6037093",
"0.6026454",
"0.59541833",
"0.5948189",
"0.59388256",
"0.59302324",
"0.59238935",
"0.5908639... | 0.74744135 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_dumb_counter
@dumb_counter = DumbCounter.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 dumb_counter_params
params.require(:dumb_counter).permit(:name, :started_at, :finished_at)
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 |
TODO def chat end | def money
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end",
"def messaging\n end",
"def chat\n @title = \"Conversacion\"\n @chats = GetChatsForPreviaGroup.call(@previa_group)\n @messages = GetMessagesForChat.call(Chat.find(params[:chat]))\n end",
"def group_chat(m... | [
"0.71277493",
"0.69906116",
"0.6941608",
"0.69262576",
"0.6884954",
"0.6791881",
"0.6680677",
"0.6648698",
"0.66090655",
"0.6586268",
"0.65407324",
"0.6518243",
"0.65007114",
"0.6465805",
"0.646169",
"0.6460132",
"0.64288944",
"0.64236057",
"0.64046794",
"0.63981307",
"0.6365... | 0.0 | -1 |
Performs a depthfirst search on all graphs containing this edge, reporting an error and failing validation if there is a loop. Keeps a list of encountered nodes and fails if it encounters the same group twice. | def validate_dag
def dfs(group, seen)
if seen.include?(group)
self.errors[:base] << (
"Creating a dependency from group '#{from.name}' to " \
+ (from.name == to.name ? "itself" : "group '#{to.name}'") \
+ " creates a cycle")
end
group.node_groups.each { |grp|
dfs(grp, seen + [group])
}
end
dfs(self.to,[self.from])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_eligibility(graph,visited,group_no,final_matchings, case_value)\n for j in 0..graph[0].size\n if(graph[group_no][j] == case_value && visited[j] == false)\n visited[j] = true\n if(final_matchings[j] ==-1 || check_eligibility(graph,visited,final_matchings[j] ,final_matchings, case_value) )\... | [
"0.5686967",
"0.56100726",
"0.55790913",
"0.5578199",
"0.5558253",
"0.5538244",
"0.5449486",
"0.5392385",
"0.5349956",
"0.5339627",
"0.53168035",
"0.53168035",
"0.52638394",
"0.5262713",
"0.52502716",
"0.5238458",
"0.5211089",
"0.5202217",
"0.51682115",
"0.5141908",
"0.514092... | 0.63520014 | 0 |
Each GiroCheckout::Message needs projectId The projectSecret can be retrieved through the projectID MerchantID is the same for all calls | def initialize(project_id)
@parameters = Hash.new(nil)
@parameters['merchantId'] = GiroCheckout.configuration.merchantId
@parameters['projectId'] = project_id
@project_secret = GiroCheckout.project_secret(project_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_for_project(message)\n ask_for(message,projects)\n end",
"def create\n @message = Message.new(params[:message])\n \n @message.project=Project.find(params[:pid])\n @message.project.pem=Pem.find(params[:pemids])\n\n respond_to do |format|\n if @message.save\n format.htm... | [
"0.56977415",
"0.5670056",
"0.5404001",
"0.53340113",
"0.532482",
"0.5272354",
"0.5272354",
"0.5272354",
"0.5256413",
"0.5244973",
"0.5225483",
"0.5216921",
"0.52006704",
"0.5167945",
"0.5150793",
"0.5150793",
"0.5150793",
"0.5150793",
"0.5150793",
"0.5150793",
"0.5150793",
... | 0.6454366 | 0 |
overwrite in child classes as order of input params is important builds the paramstring to be hashed as control of message authenticity | def build_paramstring
raise 'not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_string_params\n super + [:chls]\n end",
"def build_params(input)\n # prepare empty params hash\n @params = {}\n # separate command from other params\n _command, *input_params = input.split(' ')\n # check arguments count before proceed\n check_arguments_count(input_params)\n ... | [
"0.636539",
"0.6342644",
"0.63346535",
"0.62799305",
"0.59874696",
"0.5965626",
"0.5964688",
"0.59438694",
"0.59271115",
"0.59245825",
"0.58989215",
"0.5898168",
"0.58944076",
"0.58617795",
"0.58366627",
"0.581026",
"0.5808673",
"0.57932884",
"0.57932884",
"0.57516134",
"0.57... | 0.66884625 | 0 |
will be used for paramstring for message sending and check of result | def build_hash data
digest = OpenSSL::Digest::Digest.new('md5')
OpenSSL::HMAC.hexdigest(digest, @project_secret, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message(msg); end",
"def message( message )\n\tend",
"def message(message) end",
"def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', ... | [
"0.64779085",
"0.6373247",
"0.63700557",
"0.62805337",
"0.62720776",
"0.62583125",
"0.62583125",
"0.6196024",
"0.613238",
"0.6112144",
"0.6058566",
"0.6037824",
"0.6007787",
"0.599972",
"0.59914374",
"0.5990228",
"0.59860086",
"0.5963146",
"0.5935364",
"0.59333795",
"0.593337... | 0.0 | -1 |
should get moved to a merged request/bag | def storage_location(request)
root = Rails.application.config.upload['storage_path']
File.join root, request.bag_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_requests_to_import\n project.merge_requests.id_not_in(already_imported_objects).with_state(:merged)\n end",
"def set_request; end",
"def process(request); end",
"def request=(request); @request = request end",
"def fixup_request( request )\n\t\treturn request\n\tend",
"def store... | [
"0.60392463",
"0.5710822",
"0.5615484",
"0.5608175",
"0.55752534",
"0.5477734",
"0.5477734",
"0.54294413",
"0.53980595",
"0.53626525",
"0.53522307",
"0.5340924",
"0.5328562",
"0.52889055",
"0.5272376",
"0.5272376",
"0.5272376",
"0.5272376",
"0.5272376",
"0.5272376",
"0.527237... | 0.0 | -1 |
If a connection is available, pass it to the block, otherwise pass the fiber to the queue till a connection is available when done with a connection try to porcess other fibers in the queue before releasing the connection if inside a transaction, don't release the fiber | def hold(transactional = false)
fiber = Fiber.current
if conn = @busy_connections[fiber]
return yield(conn)
end
conn = acquire(fiber)
begin
yield conn
ensure
release(fiber, conn) unless transactional
process_queue
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hold()\n fiber = Fiber.current\n conn = acquire(fiber)\n yield conn\n end",
"def acquire(fiber)\n # A special case for rails when doing ActiveRecord stuff when not yet\n # running in the context of a request (fiber) like in the case of AR\n # queries in environme... | [
"0.73642343",
"0.73164517",
"0.7084485",
"0.70042926",
"0.698515",
"0.6958084",
"0.6838051",
"0.6676167",
"0.6622869",
"0.6579799",
"0.6493303",
"0.634226",
"0.61792004",
"0.6045064",
"0.60392857",
"0.6003254",
"0.59368765",
"0.5917821",
"0.5917821",
"0.5896381",
"0.58877915"... | 0.71615684 | 2 |
Give the fiber back to the pool you have to call this explicitly if you held a connection for a transaction | def release(fiber, conn)
@busy_connections.delete(fiber)
@connections << conn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hold()\n fiber = Fiber.current\n conn = acquire(fiber)\n yield conn\n end",
"def release()\n fiber = Fiber.current\n if fiber[connection_pool_key]\n @busy_connections.delete(fiber)\n @connections << fiber[connection_pool_key]\n fiber[connection_... | [
"0.7025837",
"0.67051804",
"0.65836596",
"0.6508456",
"0.63631916",
"0.63038355",
"0.62357503",
"0.6163824",
"0.6119163",
"0.6111689",
"0.60875374",
"0.6077574",
"0.60736924",
"0.603197",
"0.6026014",
"0.6011034",
"0.6011034",
"0.5978507",
"0.5827087",
"0.5820463",
"0.5816988... | 0.67414135 | 1 |
Can we find a connection? Can we create one? Wait in the queue then | def acquire(fiber)
if !@connections.empty?
@busy_connections[fiber] = @connections.shift
elsif (@connections.length + @busy_connections.length) < @size
conn = @connection_proc.call
@busy_connections[fiber] = conn
else
Fiber.yield @queue << fiber
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkin_connection(conn)\n @queue.push(conn)\n conn\n end",
"def checkin_connection(conn)\n @available_connections << conn\n if USE_WAITER\n @waiter.signal\n Thread.pass\n end\n conn\n end",
"def checkin_connection(conn)\n @available_connections << conn\n conn\n end",
... | [
"0.7712318",
"0.745169",
"0.7256867",
"0.70649517",
"0.70649517",
"0.69191325",
"0.68117076",
"0.6741219",
"0.671968",
"0.67015225",
"0.666666",
"0.66589314",
"0.6638949",
"0.6622752",
"0.6619021",
"0.6589322",
"0.6581418",
"0.6577187",
"0.651266",
"0.64837843",
"0.64823955",... | 0.0 | -1 |
Check if there are waiting fibers and try to process them | def process_queue
while !@connections.empty? and !@queue.empty?
fiber = @queue.shift
# What is really happening here?
# we are resuming a fiber from within
# another, should we call transfer insted?
fiber.resume @busy_connections[fiber] = @connections.shift
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def a... | [
"0.64057654",
"0.6389424",
"0.6389424",
"0.6297448",
"0.6195295",
"0.61704785",
"0.61653113",
"0.6058349",
"0.60510874",
"0.6036545",
"0.6025983",
"0.5900587",
"0.58719164",
"0.58684856",
"0.5819988",
"0.57577807",
"0.57577807",
"0.5717457",
"0.5711429",
"0.57113296",
"0.5700... | 0.549986 | 30 |
Warning the user that something isn't exactly right. | def warning(input)
puts "[\e[35m#{Time.now.strftime('%T')}\e[0m] \e[7m#{input}\e[0m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complain something\n puts angry_dude_format something\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warning(msg, ask_continue: true)\n tell(colorize(\"☞ \", :magenta) + colorize(msg, :yellow))\n exit(-1) if ask_continue && !quiz(\"continue\")\n end",
"def ... | [
"0.69832367",
"0.6792177",
"0.6792177",
"0.6792177",
"0.6667184",
"0.6597711",
"0.6563686",
"0.6537119",
"0.65191144",
"0.6466179",
"0.6465104",
"0.6444149",
"0.6444149",
"0.6406859",
"0.6406859",
"0.6328931",
"0.6303479",
"0.62593555",
"0.6236507",
"0.61928487",
"0.6176451",... | 0.60356516 | 42 |
Prompt the user so I don't have to continuously type gets.chomp 100000 times.. | def prompt(input)
print "\e[36m#{input}:\e[0m "
STDIN.gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_input(prompt)\n\tprint prompt\n\tgets.chomp #implicit return again\nend",
"def mock_me()\n puts \"Enter your input below. Type 'quit' to exit.\"\n input = gets.chomp\n until input == \"quit\" do\n puts input\n input = gets.chomp\n end\nend",
"def prompt\n print 'Type an integer number (or ... | [
"0.6554984",
"0.65410155",
"0.6488269",
"0.6487348",
"0.6442564",
"0.6354544",
"0.63528013",
"0.6332811",
"0.63321847",
"0.6282595",
"0.625847",
"0.62542456",
"0.6242161",
"0.62267566",
"0.62208575",
"0.62169516",
"0.62002313",
"0.6195626",
"0.61736894",
"0.6172228",
"0.61708... | 0.6136403 | 27 |
==== Parameters app:: Rack application. provides:: List of available MIMETypes. options:: Additional options, like +negotiate_by+. See also the Rack::Acceptable::MIMETypesdetect_best_mime_type method. | def initialize(app, provides, options = {})
raise "You should provide the list of available MIME-Types." if provides.empty?
@app = app
@provides = provides.map { |type| MIMETypes.parse_media_range(type) << type }
@provides << (options[:negotiate_by] == :qvalue_only ? true : false)
@lookup = {}
@force_format = !!options[:force_format]
if @force_format && options.key?(:default_format)
ext = options[:default_format].to_s.strip
@_extension = ext[0] == ?. ? ext : ".#{ext}" unless ext.empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accepts(*types)\n mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }\n condition do\n halt 406 unless mime_types.include?(request.media_type)\n content_type(mime_symbol(request.media_type))\n end\n end",
"def response_media_type(options=... | [
"0.6389481",
"0.6069633",
"0.60048836",
"0.58694875",
"0.5727975",
"0.56945556",
"0.5689698",
"0.5658273",
"0.5620289",
"0.55636257",
"0.5518687",
"0.5480249",
"0.5466427",
"0.54514205",
"0.5412665",
"0.5401443",
"0.53848416",
"0.5374648",
"0.5356761",
"0.5317428",
"0.5293165... | 0.7585967 | 0 |
Picks out an extension for the MIMEType given. Override this to force the usage of another MIMEType registry. See Rack::Acceptable::MIMETypes about the manipulating with entries in the registry. | def _extension_for(thing)
MIMETypes.extension_for(thing) || @_extension
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mime_type\n\t\tsuffix_without_dot = extname ? extname.sub(/\\A\\./){''}.downcase : nil\n\n\t\tMechanize::Util::DefaultMimeTypes[suffix_without_dot]\n\tend",
"def mime_type\n @mime_type ||= Rack::Mime.mime_type(\".#{ext}\")\n end",
"def _mime_type\n if defined? @_mime_type\n @_mime_t... | [
"0.72998035",
"0.7278719",
"0.724436",
"0.7126931",
"0.7119242",
"0.70268023",
"0.69875866",
"0.6985956",
"0.69528687",
"0.6949036",
"0.6943321",
"0.69253016",
"0.69138515",
"0.6910553",
"0.6884698",
"0.6883071",
"0.67967683",
"0.6707394",
"0.66814566",
"0.66555834",
"0.65601... | 0.7860962 | 0 |
Performs negotiation and memoizes result. | def _negotiate(request)
header = request.env[Const::ENV_HTTP_ACCEPT]
if @lookup.key?(header)
@lookup[header]
else
accepts = request.acceptable_media
@lookup[header] = accepts.empty? ? @provides.first : request.preferred_media_from(*@provides)
end
rescue
@lookup[header] = nil # The Accept request-header is malformed.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_request( request )\n\t\tself.log.debug \"[:negotiation] Wrapping response with HTTP content negotiation.\"\n\n\t\tresponse = super\n\t\tresponse.negotiate\n\n\t\treturn response\n\tend",
"def negotiate!; end",
"def negotiate(algorithm); end",
"def challenge\n @challenge = decode_challenge... | [
"0.5945051",
"0.53806794",
"0.52214426",
"0.51318717",
"0.50549114",
"0.50332654",
"0.49580067",
"0.49206832",
"0.4901859",
"0.48496774",
"0.48110744",
"0.47838923",
"0.47714028",
"0.47631493",
"0.47625288",
"0.47547808",
"0.4746664",
"0.474026",
"0.4710483",
"0.47015992",
"0... | 0.5207213 | 3 |
GET /resources GET /resources.json | def index
@resources = Resource.order('created_at DESC')
respond_to do |format|
format.html # index.html.erb
format.json { render json: @resources }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources\n @resources\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
... | [
"0.73273546",
"0.7318064",
"0.73039854",
"0.72687495",
"0.7259575",
"0.72584474",
"0.72268057",
"0.71765786",
"0.71211743",
"0.710327",
"0.70867956",
"0.7082584",
"0.69961977",
"0.6992777",
"0.69852436",
"0.69852436",
"0.69852436",
"0.6973388",
"0.6973388",
"0.6973388",
"0.69... | 0.69595665 | 20 |
=Manage Result of combining new edit update create /manage/:id(.format) /manage(.:format) | def manage
@resource = Resource.where(id: params[:id]).first_or_initialize
# set flags for check boxes - GET
@resource.add_coordinates = @resource.location && @resource.location.coords_set?
@resource.add_location = !(@resource.location || @resource.build_location).new_record?
if request.post? || request.put?
@resource.transaction do
r_param = params[:resource]
l_param = r_param[:location]
# set flags from check boxes
@resource.add_location = r_param[:add_location] != '0'
@resource.add_coordinates = r_param[:add_coordinates] != '0'
# set resource attributes
@resource.name = r_param[:name]
@resource.url = r_param[:url]
# save tags
@resource.tag_list = r_param[:tag_list]
if @resource.add_location
l_param = l_param.except(*Location.coords) unless @resource.add_coordinates
@resource.location = Location.find_or_initialize_by_address_and_region_id(l_param[:address], l_param[:region_id])
@resource.location.state = 'HI'
@resource.location.set_coords(l_param)
@resource.location.save!
else
@resource.location.try(:destroy) unless Resource.find_all_by_location_id(@resource.location.try(:id))
@resource.location = nil
end
@resource.save!
redirect_to(resources_path, notice: "#{@resource.name} was saved")
end
end
rescue
request.flash[:alert] = "Try again, minus the errors. #{@resource.errors.full_messages.first}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage\n\n end",
"def manage\n render \"program/#{@_class.tableize}/manage\", :layout => 'admin'\n end",
"def manage_link\n \"<br />#{link_to(\"Manage #{@scaffold_plural_name.humanize.downcase}\", :action => \"manage#{@scaffold_suffix}\")}\" if @scaffold_methods.include?(:manage)\n end",
"def ma... | [
"0.6739594",
"0.66356885",
"0.60751855",
"0.6064222",
"0.6053775",
"0.57258266",
"0.5710417",
"0.56890076",
"0.5658584",
"0.56038827",
"0.55055",
"0.5496157",
"0.5488524",
"0.5481933",
"0.5449216",
"0.5443005",
"0.53815997",
"0.5349599",
"0.5348003",
"0.5321605",
"0.531903",
... | 0.0 | -1 |
sets current user to user who just signed in this is a setter | def current_user=(user)
@current_user = user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user\n begin\n if user_signed_in?\n User.send :class_variable_set, :@@current, current_user\n end\n rescue Exception => exception\n logger.error \"Could not set User.current. Error was #{exception.to_s}\"\n end\n end",
"def set_current_user\n if logged_i... | [
"0.84312046",
"0.84102094",
"0.8346121",
"0.8332995",
"0.8312737",
"0.8312737",
"0.8312737",
"0.8312737",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0.82929444",
"0... | 0.76171964 | 79 |
when called for the first time sets the current user to the output of the find method otherwise te current usr has ben set before this is a getter | def current_user
token = User.digest(cookies[:remember_token])
@current_user = @current_user || User.find_by_remember_token(token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user\n @user = current_user\n end",
"def find_user\n @user = current_user\n end",
"def find_current_user #for madlib/user connection - am i using this?\n @user_found = User.find_by(id: session[:user_id])\n end",
"def current_user \n #if session's chef_id is set/defined, find chef base... | [
"0.7364",
"0.7364",
"0.6960344",
"0.68585926",
"0.672981",
"0.66856474",
"0.6628268",
"0.655655",
"0.6540141",
"0.65316933",
"0.65273666",
"0.6517162",
"0.6514526",
"0.651255",
"0.65017307",
"0.6500084",
"0.64880526",
"0.64847296",
"0.6477486",
"0.64767253",
"0.64692676",
"... | 0.0 | -1 |
Transform the ruby obj > to a Hash | def to_hash
index_hash = {}
index_hash['json_claz'] = self.class.name
index_hash['id'] = id
index_hash['settings_name'] = settings_name
index_hash['cattype'] = cattype
index_hash['flavor'] = flavor
index_hash['image'] = image
index_hash['catorder'] = catorder
index_hash['url'] = url
index_hash['envs'] = envs
index_hash['options'] = options
index_hash['plans'] = plans
index_hash['created_at'] = created_at
index_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_to_hash(obj)\n if obj.respond_to?(:to_hash)\n obj.to_hash\n else\n obj\n end\n end",
"def object_to_hash(obj)\n if obj.respond_to?(:to_hash)\n obj.to_hash\n else\n obj\n end\n end",
"def object_to_hash(obj)\n if obj.respond_to?(:to... | [
"0.80239445",
"0.80239445",
"0.80239445",
"0.80239445",
"0.80239445",
"0.80239445",
"0.80239445",
"0.79504997",
"0.7498411",
"0.7455195",
"0.7374761",
"0.7366702",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0.736533",
"0... | 0.0 | -1 |
Serialize this object as a hash: called from JsonCompat. Verify if this called from JsonCompat during testing. | def to_json(*a)
for_json.to_json(*a)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n JSON.dump(@hash)\n end",
"def serialize\n self.to_hash.to_json\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def serialize(hash)\n { Arguments::OBJECT_SERIALIZER_KEY => self.class.n... | [
"0.78814876",
"0.7705651",
"0.7421214",
"0.73655856",
"0.72824526",
"0.72677153",
"0.7236646",
"0.7198739",
"0.7192137",
"0.7182457",
"0.713986",
"0.70491207",
"0.7028422",
"0.70275414",
"0.6964936",
"0.69634926",
"0.69519633",
"0.6945002",
"0.69268817",
"0.69268817",
"0.6926... | 0.0 | -1 |
Create the marketplace app via the REST API | def create
megam_rest.post_marketplaceapp(to_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def create\n form = NewMarketplaceForm.new(params)\n return render status: 400, ... | [
"0.73451185",
"0.689567",
"0.68646526",
"0.686129",
"0.68517363",
"0.684539",
"0.6802229",
"0.672864",
"0.6567937",
"0.6564708",
"0.65423185",
"0.65390027",
"0.6519266",
"0.6510907",
"0.6476623",
"0.64545953",
"0.6451449",
"0.6413335",
"0.63996476",
"0.6372026",
"0.6349582",
... | 0.8501401 | 1 |
Introspection on the column to determine how to render a method. The method is used to identify a method type (if the method corresponds to a column) Returns: :text for columns of type 'text' :string for columns of type 'string' :integer for columns of type 'integer' :float for columns of type 'float' :decimal for columns of type 'decimal' :datetime for columns of type 'datetime' :date for columns of type 'date' :time for columns of type 'time' nil for unkown columns | def type(method)
if @object.respond_to?(:has_attribute?) && @object.has_attribute?(method)
column = @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)
return column.type if column
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_type\n object.class.scaffold_column_type(@method_name)\n end",
"def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n end",
"def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @obje... | [
"0.7637565",
"0.6905805",
"0.6905805",
"0.6826684",
"0.68164533",
"0.6734326",
"0.66782075",
"0.6579896",
"0.647001",
"0.643616",
"0.6371206",
"0.6330493",
"0.6313163",
"0.6245976",
"0.6205602",
"0.6186831",
"0.60898894",
"0.60765153",
"0.6075175",
"0.6073526",
"0.60734576",
... | 0.7151826 | 1 |
Introspection on an association to determine if a method is a file. This is determined by the methods ability to respond to file methods. | def file?(method)
@files ||= {}
@files[method] ||= begin
file = @object.send(method) if @object && @object.respond_to?(method)
file && ::Formula.file.any? { |method| file.respond_to?(method) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to?(meth)\n File.instance_methods.any? { |m| m == meth.to_s || m == meth.to_sym }\n end",
"def file?\n type == :file\n end",
"def file?\n self.file.file?\n end",
"def file_set?(resource)\n resource.respond_to?(:file_metadata) && !resource.respond_to?(:member_ids)\n end",
... | [
"0.64243644",
"0.6183361",
"0.6008551",
"0.5834453",
"0.56480205",
"0.5623125",
"0.56152356",
"0.55852383",
"0.5584837",
"0.5549622",
"0.5514385",
"0.5457542",
"0.544359",
"0.54346955",
"0.5409587",
"0.5390454",
"0.5386024",
"0.53712416",
"0.536934",
"0.5355118",
"0.5303647",... | 0.6767179 | 0 |
Introspection on the field and method to determine how to render a method. The method is used to generate form element types. Returns: :url for columns containing 'url' :email for columns containing 'email' :phone for columns containing 'phone' :password for columns containing 'password' :number for integer, float or decimal columns :datetime for datetime or timestamp columns :date for date column :time for time column :text for time column :string for all other cases | def as(method)
case "#{method}"
when /url/ then return :url
when /email/ then return :email
when /phone/ then return :phone
when /password/ then return :password
end
case type(method)
when :string then return :string
when :integer then return :number
when :float then return :number
when :decimal then return :number
when :timestamp then return :datetime
when :datetime then return :datetime
when :date then return :date
when :time then return :time
when :text then return :text
end
return :file if file?(method)
return ::Formula.default_as
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_fields(meth)\n parts = [ ]\n self.fields.each do |k,f|\n parts.push(f.send(meth, type))\n end\n return parts.join('')\n end",
"def type_for_field(method, options)\n if @object.nil?\n :string\n elsif @object.class.respond_to?(:meta_field)\n @object.class.me... | [
"0.64461595",
"0.629406",
"0.6222858",
"0.6119378",
"0.5843644",
"0.5762577",
"0.57415074",
"0.5740619",
"0.5714095",
"0.56312937",
"0.5612161",
"0.5609553",
"0.56029576",
"0.5596176",
"0.5561869",
"0.5533327",
"0.55057913",
"0.54787004",
"0.54648453",
"0.5450282",
"0.5436428... | 0.56233597 | 10 |
Generate error messages by combining all errors on an object into a comma seperated string representation. | def error(method)
errors = @object.errors[method] if @object
errors.to_sentence if errors.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message(obj)\n obj.errors.full_messages.join(',')\n end",
"def errors_string\n getErrors.map { |e| \"(#{e.object || ''}): #{e.error}\" }.join(', ').strip\n end",
"def write_errors(obj, scope: false)\n obj.errors.map { |e| \"#{t_field(e.attribute, scope || obj.class.table_name.singulari... | [
"0.7499175",
"0.74928266",
"0.7483025",
"0.7200762",
"0.69183034",
"0.68879795",
"0.6753576",
"0.67248946",
"0.6571372",
"0.6555481",
"0.65478396",
"0.6536333",
"0.6511829",
"0.6413392",
"0.6413155",
"0.6403338",
"0.6395019",
"0.6389107",
"0.63817173",
"0.63817173",
"0.637598... | 0.57198846 | 99 |
Identify if error message exists for a given method by checking for the presence of the object followed by the presence of errors. | def error?(method)
@object.present? and @object.errors[method].present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors_for?(method)\n nil\n end",
"def errors_on_attribute?(method)\n return false if @object.nil?\n !(@object.errors.empty? || !@object.errors[method.to_sym].present? || [@object.errors[method.to_sym]].flatten.empty?)\n end",
"def error(method)\n errors = @object.errors... | [
"0.71690303",
"0.6802962",
"0.6516561",
"0.61634356",
"0.6004026",
"0.5961958",
"0.5956491",
"0.58846086",
"0.585896",
"0.5851333",
"0.58277094",
"0.57870924",
"0.57033503",
"0.5697453",
"0.56754315",
"0.56538266",
"0.56492555",
"0.56261575",
"0.5624888",
"0.56117797",
"0.559... | 0.79361695 | 0 |
Create an array from a string, a symbol, or an undefined value. The default is to return the value and assume it has already is valid. | def arrayorize(value)
case value
when nil then return []
when String then value.to_s.split
when Symbol then value.to_s.split
else value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_string_array sym, name=nil, &block\n def_transform(sym) {|v|\n next nil if v == nil\n orig = self[sym]\n if v.one_of_type? Array, Enumerable\n add = v.map {|x| x.to_s}\n next orig ? orig + add : add\n end\n orig ? orig << v.to_s : [v... | [
"0.56792295",
"0.56792295",
"0.55506295",
"0.5544576",
"0.5499632",
"0.54120165",
"0.527592",
"0.5241584",
"0.5241584",
"0.5103305",
"0.50809115",
"0.5044936",
"0.5027215",
"0.50010145",
"0.49961242",
"0.49679774",
"0.49639553",
"0.49389327",
"0.49157557",
"0.49031782",
"0.48... | 0.61288834 | 0 |
Generates a wrapper around fields_form with :builder set to FormulaFormBuilder. Supports: | def formula_fields_for(record_or_name_or_array, *args, &block)
options = args.extract_options!
options[:builder] ||= self.class
fields_for(record_or_name_or_array, *(args << options), &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def build_form(form_builder, options = {})\n set_value_in_hash opt... | [
"0.69057703",
"0.6342732",
"0.63238186",
"0.62691826",
"0.6256049",
"0.6243949",
"0.61949474",
"0.61619526",
"0.6124243",
"0.61200947",
"0.6052817",
"0.60001975",
"0.59793144",
"0.59208804",
"0.5903405",
"0.59030503",
"0.58659685",
"0.5794019",
"0.5775417",
"0.5760636",
"0.57... | 0.6485412 | 1 |
Generates a wrapper around form_for with :builder set to FormulaFormBuilder. Supports: | def formula_form_for(record_or_name_or_array, *args, &proc)
options = args.extract_options!
options[:builder] ||= @@builder
form_for(record_or_name_or_array, *(args << options), &proc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_form(form_builder, options)\n set_value_in_hash options\n if options.delete(:for) == :search\n build_search_form(form_builder, options)\n else\n build_for_admin_interface_form(form_builder, options)\n end\n end",
"def builder\n form\n end",
"def build_form(form_builder,... | [
"0.67873347",
"0.6547571",
"0.65383786",
"0.638702",
"0.6300584",
"0.62844646",
"0.62478137",
"0.6219336",
"0.6218707",
"0.621454",
"0.6169412",
"0.6155559",
"0.60979354",
"0.60951287",
"0.60176414",
"0.5981424",
"0.5925192",
"0.5921918",
"0.5837123",
"0.58309835",
"0.5824998... | 0.68389285 | 0 |
Generates a wrapper around fields_for with :builder set to FormulaFormBuilder. Supports: | def formula_fields_for(record_or_name_or_array, *args, &block)
options = args.extract_options!
options[:builder] ||= @@builder
fields_for(record_or_name_or_array, *(args << options), &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def formula_fields_for(record_or_name_or_array, *args, &block)\n ... | [
"0.7065595",
"0.6738615",
"0.6473491",
"0.6343853",
"0.6217724",
"0.60969865",
"0.60857534",
"0.60755086",
"0.6001662",
"0.59559727",
"0.5933645",
"0.59320295",
"0.59023124",
"0.5864279",
"0.5862821",
"0.5793941",
"0.57820445",
"0.5778511",
"0.57780826",
"0.56798273",
"0.5627... | 0.64384496 | 3 |
=begin delete object recent viewed list, will be executed automatically model = Model.find(123) model.recent_view_destroy =end | def recent_view_destroy
RecentView.log_destroy(self.class.to_s, id)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n ... | [
"0.67903584",
"0.64097786",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.6360573",
"0.63517207",
"0.6329353",
"0.6289652",
"0.62833935",
"0.62833935",
"0.6259639",
"0.6259639",
"0.6251306",
"0.6205909"... | 0.71338904 | 0 |
GET /confessions GET /confessions.json | def index
@confessions = Confession.where(:user_id => current_user._id)
respond_to do |format|
format.html # index.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confession }\n end\n end",
"def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end",
"def... | [
"0.75820893",
"0.7436223",
"0.6660346",
"0.6660346",
"0.6481751",
"0.64753616",
"0.64315134",
"0.6386532",
"0.62772304",
"0.62689644",
"0.61816853",
"0.6069018",
"0.60294324",
"0.6028336",
"0.60199046",
"0.5992754",
"0.5947879",
"0.59410083",
"0.59312683",
"0.5926963",
"0.592... | 0.7064965 | 2 |
GET /confessions/new GET /confessions/new.json | def new
@confession = Confession.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @confession }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @confession = Confession.new(params[:confession])\n\n respond_to do |format|\n if @confession.save\n format.html { redirect_to @confession, notice: 'Confession was successfully created.' }\n format.json { render json: @confession, status: :created, location: @confession }\n ... | [
"0.77662385",
"0.73202866",
"0.72905695",
"0.7252565",
"0.72521937",
"0.71988827",
"0.71988827",
"0.71988827",
"0.71988827",
"0.71988827",
"0.71988827",
"0.71988827",
"0.7131593",
"0.70395833",
"0.7033853",
"0.70062697",
"0.69967574",
"0.69928694",
"0.696139",
"0.6953135",
"0... | 0.84529674 | 1 |
POST /confessions POST /confessions.json | def create
@confession = Confession.new(confession_params)
@confession.user = current_user
respond_to do |format|
if @confession.save
format.html { redirect_to admin_root_path, notice: 'Confession was successfully created.' }
else
format.html { render action: "new" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @confession = Confession.new(params[:confession])\n\n respond_to do |format|\n if @confession.save\n format.html { redirect_to @confession, notice: 'Confession was successfully created.' }\n format.json { render json: @confession, status: :created, location: @confession }\n ... | [
"0.7435945",
"0.66320705",
"0.65543354",
"0.6520697",
"0.65137804",
"0.6509982",
"0.6509982",
"0.6410066",
"0.6277311",
"0.6182467",
"0.60743153",
"0.6065895",
"0.60631126",
"0.59954184",
"0.589715",
"0.58620304",
"0.5726772",
"0.5718838",
"0.57089293",
"0.5702872",
"0.563964... | 0.6281356 | 8 |
PATCH/PUT /confessions/1 PATCH/PUT /confessions/1.json | def update
@confession = Confession.find(params[:id])
respond_to do |format|
if @confession.update_attributes(confession_params)
format.html { redirect_to admin_root_path, notice: 'Confession was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @confession.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n if @confession.update_attributes(params[:confession])\n format.html { redirect_to @confession, notice: 'Confession was successfully updated.' }\n format.json { head :no_content }\n else\n forma... | [
"0.73055017",
"0.6654235",
"0.632487",
"0.63245195",
"0.6278914",
"0.6257835",
"0.6165021",
"0.61020315",
"0.6050157",
"0.6045273",
"0.6025302",
"0.6000633",
"0.59968454",
"0.5994039",
"0.5974075",
"0.5967731",
"0.5967731",
"0.5967731",
"0.5967731",
"0.5967731",
"0.5964292",
... | 0.72372854 | 1 |
DELETE /confessions/1 DELETE /confessions/1.json | def destroy
@confession = Confession.find(params[:id])
@confession.destroy
respond_to do |format|
format.html { redirect_to admin_confessions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @confession = Confession.find(params[:id])\n @confession.destroy\n\n respond_to do |format|\n format.html { redirect_to confessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profession.destroy\n respond_to do |format|\n format.html... | [
"0.7777999",
"0.7068872",
"0.6865867",
"0.680768",
"0.66584486",
"0.66574734",
"0.66444314",
"0.6629976",
"0.6629126",
"0.6593027",
"0.6571138",
"0.6567393",
"0.6563897",
"0.6542996",
"0.65351564",
"0.6515078",
"0.65126735",
"0.64935035",
"0.64930993",
"0.6488069",
"0.6486903... | 0.7669183 | 1 |
def class_namespace_exist? namespace_name File.exist? class_to_basefile(namespace_name) end First search for "./class_name.resource_name" files And then search for "./class_name.res/resource_name" files | def resource_get class_name, resource_name
path = "#{class_to_basefile(class_name)}.#{resource_name}"
data, readed = nil, false
if File.exist? path
data = File.read path
readed = true
else
path = "#{class_to_basefile(class_name)}.res/#{resource_name}"
if File.exist? path
data = File.read path
readed = true
end
end
raise Resource::NotExist unless readed
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_class(module_name)\n file_array = module_name.split('::')\n\n #search module path for the class\n $mod_dir.each do |y|\n if File.directory?(\"#{y}/#{file_array[0]}\")\n @filename = \"#{y}/#{file_array[0]}\"\n break\n end\n end\n\n #did we find the class?\n if defined? @filename\n ... | [
"0.66952074",
"0.6674407",
"0.6287668",
"0.5967568",
"0.59305626",
"0.59150666",
"0.5903542",
"0.5834392",
"0.58159995",
"0.58134365",
"0.57476807",
"0.5744245",
"0.57256424",
"0.5698257",
"0.56764853",
"0.56723213",
"0.5671167",
"0.56689006",
"0.5617523",
"0.5613069",
"0.560... | 0.5391615 | 55 |
First search for the same resource and owerwrites it If such resource doesn't exists writes to "./class_name.res/resource_name" file. | def resource_set class_name, resource_name, data
path = "#{class_to_basefile(class_name)}.#{resource_name}"
if File.exist? path
length = File.write path, data
else
dir = "#{class_to_basefile(class_name)}.res"
FileUtils.mkdir dir unless File.exist? dir
path = "#{dir}/#{resource_name}"
length = File.write path, data
end
remember_file path
return length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n self.theme_assets_by_priority.each do |asset|\n self.output_resource_op asset\n\n self.open_file(self.target_asset_path(asset), 'wb') do |file|\n content = asset.content\n\n if asset.stylesheet_or_javascript?\n self.rep... | [
"0.6573734",
"0.6053649",
"0.59788096",
"0.58930266",
"0.578734",
"0.5696558",
"0.56425256",
"0.56420994",
"0.5605624",
"0.54679185",
"0.5405675",
"0.53863704",
"0.5382462",
"0.5364806",
"0.5358843",
"0.53537846",
"0.5350216",
"0.53383243",
"0.533086",
"0.5324142",
"0.5314634... | 0.6609596 | 0 |
Different Providers can use different class path interpretation. So we return virtual path only if this path really exist. | def class_to_virtual_file class_name
result = nil
if @cache.include? class_name
result = @cache[class_name]
else
result = nil
path = class_to_basefile class_name
if File.exist? path
result = path
else
path2 = "#{path}.rb"
if File.exist? path2
result = path
else
path3 = "#{path}.res"
if File.exist? path3
result = path
end
end
end
@cache[class_name] = result
end
if result
return "#{result}.rb"
else
raise Resource::NotExist, "Class '#{class_name}' doesn't Exist!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virtual_path; end",
"def virtual_path; end",
"def virtual_path; end",
"def find_path\n fail ProcessorNotImplementedError,\n \"Please implement #{self.class}#find_path\"\n end",
"def existing_path(resolved_path)\n raise NotImplementedError.new\n end",
"def path\n ... | [
"0.67313886",
"0.67313886",
"0.67313886",
"0.6162194",
"0.5891325",
"0.585868",
"0.5853353",
"0.58319926",
"0.58164614",
"0.58080065",
"0.57835627",
"0.57746565",
"0.5761477",
"0.5723596",
"0.5663069",
"0.5659676",
"0.5608427",
"0.5600952",
"0.5593413",
"0.5584046",
"0.557025... | 0.0 | -1 |
Different Providers can use different class path interpretation. So we return virtual path only if this path really exist. | def class_to_basefile class_name
return "#{base_dir}/#{class_name.gsub("::", "/")}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virtual_path; end",
"def virtual_path; end",
"def virtual_path; end",
"def find_path\n fail ProcessorNotImplementedError,\n \"Please implement #{self.class}#find_path\"\n end",
"def existing_path(resolved_path)\n raise NotImplementedError.new\n end",
"def path\n ... | [
"0.6731482",
"0.6731482",
"0.6731482",
"0.61626637",
"0.58920264",
"0.58571166",
"0.58546305",
"0.5829543",
"0.58167887",
"0.58081996",
"0.57855564",
"0.577083",
"0.57611066",
"0.5723528",
"0.566466",
"0.5657904",
"0.56105524",
"0.5601202",
"0.55943435",
"0.5583166",
"0.55692... | 0.0 | -1 |
Each inventoriable type should handle its associations | def new_with_associations
raise "Method not implemented, please define \"self.new_with_associations\" in #{model_name.to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associations; end",
"def handle_association_links\n @type = @normalized_type = @subtype\n obj = model.with_pk(@type, request, request.id)\n association_links(obj)\n end",
"def associated\n end",
"def setup_associations; end",
"def enable_relationships\n self.items.each do ... | [
"0.65461916",
"0.6403433",
"0.63076824",
"0.62609965",
"0.6020697",
"0.5969904",
"0.5876547",
"0.586485",
"0.58508444",
"0.57416326",
"0.57271963",
"0.5707711",
"0.5703843",
"0.56861305",
"0.56699085",
"0.56043565",
"0.5602706",
"0.55983555",
"0.5569237",
"0.5569237",
"0.5551... | 0.0 | -1 |
Each inventoriable type should handle the cloning operation | def clone_with_associations
raise "Method not implemented, please define \"clone_with_associations\" in #{model_name.to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(*) end",
"def clone(*) end",
"def clone\n raise NotImplementedError\n end",
"def clone() end",
"def clone; end",
"def clone; end",
"def clone; end",
"def clone\n super\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"de... | [
"0.73021287",
"0.73021287",
"0.7295897",
"0.7248092",
"0.70742434",
"0.70742434",
"0.70742434",
"0.7073687",
"0.7038516",
"0.7022174",
"0.7022174",
"0.7022174",
"0.6994914",
"0.6795392",
"0.6694649",
"0.6461808",
"0.6444915",
"0.6435568",
"0.6392665",
"0.63725644",
"0.6334955... | 0.58982897 | 49 |
Rails 2.2 does not provide support for Nested Forms, this will have to be removed and the forms fixed after the upgrade | def asset_attributes=(attributes)
unless asset.new_record?
asset.attributes = attributes
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested_forms\n []\n end",
"def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end",
"def set_nestedform\n @nestedform ... | [
"0.73082614",
"0.62430465",
"0.60996795",
"0.60669094",
"0.6053535",
"0.5942364",
"0.5921294",
"0.58427083",
"0.5804695",
"0.5804695",
"0.570473",
"0.55766195",
"0.5555147",
"0.5537673",
"0.5535744",
"0.549445",
"0.54913527",
"0.54800487",
"0.54783803",
"0.5477121",
"0.547425... | 0.0 | -1 |
base_url the base url from which the urls for all atdis urls are made It should be of the form: | def initialize(base_url)
@base_url = base_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_url\n return url\n end",
"def base_url\n base_href || url\n end",
"def base_url_path; end",
"def base_url\n context[:base_url] || \"/\"\n end",
"def baseurl; end",
"def base_url\n @base_url||=@options['base_url']\n end",
"def base_url\n self.class.base_url\n ... | [
"0.826374",
"0.80721736",
"0.7999142",
"0.79828846",
"0.79525644",
"0.7787665",
"0.7745205",
"0.7726401",
"0.765864",
"0.76421815",
"0.7575162",
"0.75750494",
"0.75345886",
"0.74807346",
"0.74670136",
"0.74653584",
"0.73092675",
"0.72931254",
"0.7290848",
"0.7280058",
"0.7252... | 0.6560066 | 86 |
Set the name of the node | def node=(node)
query[:node] = node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_node_name(node_id:, name:)\n {\n method: \"DOM.setNodeName\",\n params: { nodeId: node_id, name: name }.compact\n }\n end",
"def node_name(name)\n self.__add_string('node_name', name)\n end",
"def on_node_name_set( node, name )\n\t\t\tself.log.debug ... | [
"0.8485612",
"0.8464726",
"0.8146241",
"0.79770464",
"0.79127145",
"0.7851207",
"0.776399",
"0.7717336",
"0.75549084",
"0.7545084",
"0.742008",
"0.741497",
"0.741497",
"0.741497",
"0.741497",
"0.741497",
"0.7309485",
"0.7254467",
"0.7254467",
"0.7253895",
"0.72298366",
"0.7... | 0.0 | -1 |
GET /movimentos GET /movimentos.xml | def contas_a_pagar
@movimentos = Movimento.find(:all,:conditions => ["data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'", current_usuario.entidade_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @movimentacaos = Movimentacao.all\n end",
"def index\n @movimentacaos = Movimentacao.all\n end",
"def index\n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @movies }\n end\n end",
"def show\n @regiment =... | [
"0.6638986",
"0.6638986",
"0.6354446",
"0.6332599",
"0.62950885",
"0.62863404",
"0.62533784",
"0.6195948",
"0.6172763",
"0.61674523",
"0.61571956",
"0.61472946",
"0.614299",
"0.61354023",
"0.61223865",
"0.61223865",
"0.6116863",
"0.6064979",
"0.6063257",
"0.6050216",
"0.60255... | 0.0 | -1 |
GET /movimentos/1 GET /movimentos/1.xml | def show
# begin
@movimento = Movimento.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @movimento }
end
# rescue ActiveRecord::RecordNotFound => erro
# flash[:error] = "Registro não encontrado"
# redirect_to :controller => "erros", :action => "index"
# rescue => erro
# flash[:error] = "Ocorreu o seguinte erro: #{erro}"
# redirect_to :controller => "erros", :action => "index"
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @regiment = Regiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def index\n @movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render... | [
"0.6429265",
"0.62184274",
"0.6195308",
"0.61518794",
"0.61441237",
"0.6134153",
"0.6134153",
"0.61114633",
"0.61114234",
"0.60972923",
"0.6065716",
"0.6043362",
"0.60205775",
"0.60175747",
"0.6014997",
"0.5999618",
"0.59917414",
"0.5981323",
"0.5978682",
"0.5971933",
"0.5968... | 0.0 | -1 |
GET /movimentos/new GET /movimentos/new.xml | def new
@movimento = Movimento.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @movimento }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end",
"def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml... | [
"0.7308372",
"0.72207874",
"0.71675736",
"0.7093291",
"0.7021684",
"0.70111525",
"0.7001097",
"0.6973071",
"0.6951425",
"0.6849423",
"0.681592",
"0.68030375",
"0.67926466",
"0.677328",
"0.67514414",
"0.6746999",
"0.67402184",
"0.674001",
"0.67300934",
"0.6729814",
"0.67267084... | 0.7158229 | 4 |
POST /movimentos POST /movimentos.xml | def create
@movimento = Movimento.new(params[:movimento])
@movimento.entidade_id = current_usuario.entidade_id
@movimento.valor = params[:movimento][:valor].gsub(',','.')
@movimento.usuario_id = current_usuario.id
#@movimento.updated_by = current_usuario.id
@movimento.data_vencimento = @movimento.data_pagamento if current_usuario.entidade_id == 1
respond_to do |format|
if @movimento.save
flash[:notice] = 'Movimento cadastrado com sucesso.'
format.html { redirect_to(@movimento) }
format.xml { render :xml => @movimento, :status => :created, :location => @movimento }
else
format.html { render :action => "new" }
format.xml { render :xml => @movimento.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @movimentacao = Movimentacao.new(movimentacao_params)\n\n respond_to do |format|\n if @movimentacao.save\n format.html { redirect_to @movimentacao, notice: 'Movimentacao was successfully created.' }\n format.json { render :show, status: :created, location: @movimentacao }\n ... | [
"0.66051793",
"0.6073662",
"0.6043104",
"0.5988949",
"0.59882355",
"0.59882355",
"0.59736484",
"0.5973526",
"0.5895117",
"0.576096",
"0.57466394",
"0.5717176",
"0.570185",
"0.567798",
"0.5606926",
"0.5575627",
"0.5527501",
"0.5527501",
"0.54971737",
"0.54555213",
"0.54520845"... | 0.5223979 | 43 |
PUT /movimentos/1 PUT /movimentos/1.xml | def update
begin
@movimento = Movimento.find(params[:id])
params[:movimento][:valor] = params[:movimento][:valor].to_s.gsub(',','.').to_f
@movimento.updated_by = current_usuario.id
respond_to do |format|
if @movimento.update_attributes(params[:movimento])
flash[:notice] = 'Movimento atualizado com sucesso.'
format.html { redirect_to(@movimento) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @movimento.errors, :status => :unprocessable_entity }
end
end
rescue ActiveRecord::RecordNotFound => erro
flash[:error] = "Registro não encontrado"
redirect_to :controller => "erros", :action => "index"
rescue => erro
flash[:error] = "Ocorreu o seguinte erro: #{erro}"
redirect_to :controller => "erros", :action => "index"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_movimentacao\n @movimentacao = Movimentacao.find(params[:id])\n end",
"def set_movimentacao\n @movimentacao = Movimentacao.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @movimentacao.update(movimentacao_params)\n format.html { redirect_to @movimentac... | [
"0.63776153",
"0.63776153",
"0.6252446",
"0.6242088",
"0.6222116",
"0.6132708",
"0.59800017",
"0.5925095",
"0.5908751",
"0.59050506",
"0.58921635",
"0.5858463",
"0.5771138",
"0.57462215",
"0.57354814",
"0.5734337",
"0.572777",
"0.5717391",
"0.5715137",
"0.5702134",
"0.5655942... | 0.0 | -1 |
DELETE /movimentos/1 DELETE /movimentos/1.xml | def destroy
begin
@movimento = Movimento.find(params[:id])
@movimento.destroy
respond_to do |format|
format.html { redirect_to(movimentos_url) }
format.xml { head :ok }
end
rescue ActiveRecord::RecordNotFound => erro
flash[:error] = "Registro não encontrado"
redirect_to :controller => "erros", :action => "index"
rescue => erro
flash[:error] = "Ocorreu o seguinte erro: #{erro}"
redirect_to :controller => "erros", :action => "index"
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 @vestimenta = Vestimenta.find(params[:id])\n @vestimenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(vestimentas_url) }\n format.xml { head :ok }\n end\n end",
... | [
"0.7025089",
"0.7014899",
"0.67567885",
"0.6742883",
"0.6742063",
"0.66885746",
"0.6675449",
"0.6665854",
"0.6663947",
"0.6644389",
"0.6637164",
"0.6631827",
"0.66275847",
"0.6623368",
"0.6622809",
"0.6619813",
"0.66196036",
"0.66180795",
"0.661754",
"0.66050637",
"0.6588125"... | 0.63831466 | 95 |
GET /friends1s or /friends1s.json | def index
@friends1s = Friends1.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_ge... | [
"0.7511458",
"0.7256488",
"0.7221007",
"0.7035518",
"0.6994994",
"0.69643795",
"0.68624014",
"0.6834628",
"0.6784445",
"0.6758147",
"0.6739091",
"0.67073774",
"0.6681783",
"0.6641915",
"0.6637004",
"0.66344136",
"0.6618299",
"0.659515",
"0.65926516",
"0.6584757",
"0.65504485"... | 0.694123 | 6 |
GET /friends1s/1 or /friends1s/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def friends(options={})\n perform_get(\"statuses/friends.#{Twitter.format}\", options)\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_ge... | [
"0.72231746",
"0.70624983",
"0.70037824",
"0.69499093",
"0.69155216",
"0.68726665",
"0.68037564",
"0.6803076",
"0.67755497",
"0.67183936",
"0.671716",
"0.6683911",
"0.6612707",
"0.6591467",
"0.6585549",
"0.65691125",
"0.65545636",
"0.65485203",
"0.65425116",
"0.6514151",
"0.6... | 0.0 | -1 |
POST /friends1s or /friends1s.json | def create
@friends1 = Friends1.new(friends1_params)
respond_to do |format|
if @friends1.save
format.html { redirect_to @friends1, notice: "Friend was successfully created." }
format.json { render :show, status: :created, location: @friends1 }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @friends1.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya bee... | [
"0.66812724",
"0.66605985",
"0.648468",
"0.6442773",
"0.6397779",
"0.6360496",
"0.63327456",
"0.6325506",
"0.62714136",
"0.6269875",
"0.62429976",
"0.62232196",
"0.6221303",
"0.6203833",
"0.61905825",
"0.6189519",
"0.6180644",
"0.6174631",
"0.6163327",
"0.6147471",
"0.6141358... | 0.7161355 | 0 |
PATCH/PUT /friends1s/1 or /friends1s/1.json | def update
respond_to do |format|
if @friends1.update(friends1_params)
format.html { redirect_to @friends1, notice: "Friend was successfully updated." }
format.json { render :show, status: :ok, location: @friends1 }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @friends1.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_friends\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Your friends were updated successfully.'\n format.html { redirect_to(user_friendships_path(@user)) }\n else\n format.html { render :act... | [
"0.68443686",
"0.67870355",
"0.6778489",
"0.6764428",
"0.67330956",
"0.6719105",
"0.67001295",
"0.6691678",
"0.66866255",
"0.66866255",
"0.66866255",
"0.66866255",
"0.66866255",
"0.66857135",
"0.66857135",
"0.6595267",
"0.65789616",
"0.6531415",
"0.6518295",
"0.6517071",
"0.6... | 0.7528879 | 0 |
DELETE /friends1s/1 or /friends1s/1.json | def destroy
@friends1.destroy
respond_to do |format|
format.html { redirect_to friends1s_url, notice: "Friend was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_friend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \tif @user.friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} deleted!\"\n format.json{render :json => {:message => message, :status => \"200\"... | [
"0.7196663",
"0.7129877",
"0.7117145",
"0.71170443",
"0.705106",
"0.7046745",
"0.7018361",
"0.69943595",
"0.69889003",
"0.6982909",
"0.69807297",
"0.69543636",
"0.6943653",
"0.69122875",
"0.6905287",
"0.68754137",
"0.6867057",
"0.685024",
"0.68485683",
"0.68353397",
"0.683243... | 0.76925635 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_friends1
@friends1 = Friends1.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def friends1_params
params.require(:friends1).permit(:first_name, :last_name, :email, :phone, :instagram, :user_id)
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 |
Inside the method set a loop counter called i equal to 0 Create an empty string that will hold the solution Setup a while loop where i is less than the length of our parameter (x) Then set the string variable to add the next letter of the parameter's index with the index being set to i Then set the loop counter (i) to increase by 1 at the end of each loop End the while loop Then set the string to print using "puts" Then end the method Then call the method using any parameter | def encrypt(x)
i = 0
string = ""
while i < x.length
if x[i].next == "aa"
string += "a"
else
string += x[i].next
end
i += 1
end
string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pirates_say_arrrrrrrrr(string) #defines a method with 1 parameter\n answer = \"\" #sets up a blank variable for the answer\n add_next_letter = false #sets up a va... | [
"0.6432658",
"0.6408425",
"0.61725634",
"0.61638534",
"0.61501485",
"0.61212635",
"0.61205417",
"0.6119427",
"0.61109024",
"0.61002713",
"0.6096789",
"0.60932297",
"0.6082396",
"0.6082396",
"0.60758716",
"0.6074945",
"0.6070652",
"0.60519063",
"0.6043248",
"0.6038534",
"0.603... | 0.0 | -1 |
Define a method "decrypt" with parameter x setup a loop starting with an i that equals 0 Create two variables, an alphabet variable with the alphabet in it and a string variable that is empty Setup a while loop where i is less than the length of x Set a new variable (new_var) equal to alphabet.index( ) Then inside the parenthesis add index i of x Then set the string variable to add a new letter that is 1 index less than it originally was Then set the loop counter to increase by 1 at the end of the while loop Then end the while loop Then set string to print using puts Then end the method Then call the method | def decrypt(x)
i = 0
alphabet = "abcdefghijklmnopqrstuvwxyz"
string = ""
while i < x.length
new_var = alphabet.index(x[i])
string += alphabet[new_var - 1]
i += 1
end
string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt_method(arg, index)\n while index < arg.length\n if arg[index] == \"a\"\n arg[index] = \"z\"\n index += 1\n else\n arg[index] = (arg[index].ord - 1).chr\n index += 1\n end\n end\n puts arg\nend",
"def decrypt (encrypt_password)\r\n\talphabet = \"abcdefghijklmnopqrstuvwx... | [
"0.8097856",
"0.8085213",
"0.80691576",
"0.80081236",
"0.8001357",
"0.7995902",
"0.7973583",
"0.7960228",
"0.7930519",
"0.7905967",
"0.7892892",
"0.78862035",
"0.7871933",
"0.7868445",
"0.7866586",
"0.7821564",
"0.78193545",
"0.78184813",
"0.7816376",
"0.77940947",
"0.7754215... | 0.83952814 | 0 |
GET /small_categories GET /small_categories.json | def index
@small_categories = SmallCategory.category_tree
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.7103989",
"0.68264025",
"0.673374",
"0.6719716",
"0.6701768",
"0.66669464",
"0.6645072",
"0.6636345",
"0.65947783",
"0.6573534",
"0.6522106",
"0.64214724",
"0.6414349",
"0.6411611",
"0.64040506",
"0.63976395",
"0.6336373",
"0.63356936",
"0.63356936",
"0.63284016",
"0.63252... | 0.74789083 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.