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 |
|---|---|---|---|---|---|---|
Find project root. This searches up from the current working directory for a .map configuration file or source control manager directory. .ruby/ .map .git/ .hg/ .svn/ _darcs/ If all else fails the current directory is returned. | def lookup_root
root = nil
Dir.ascend(Dir.pwd) do |path|
check = Dir[ROOT_GLOB].first
if check
root = path
break
end
end
root || Dir.pwd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate_root(dir=Dir.pwd)\n dir = File.expand_path(dir)\n home = File.expand_path('~')\n while dir != home && dir != '/'\n return dir if Dir[File.join(dir, '{.git,.hg,.index,.gemspec,*.gemspec}')].first\n dir = File.dirname(dir)\n end\n while dir != home && ... | [
"0.7305038",
"0.72455513",
"0.70090777",
"0.69840777",
"0.6898912",
"0.6853174",
"0.679962",
"0.676621",
"0.67634195",
"0.67634195",
"0.6746254",
"0.67148507",
"0.6712813",
"0.6635481",
"0.6610172",
"0.6586969",
"0.6535325",
"0.6533569",
"0.6422674",
"0.6408766",
"0.63944876"... | 0.7433538 | 0 |
Convenience method to allow configuration options to be set in a block | def configure
yield self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end",
"def config(&block)\n instance_eval(&block) if block_given?\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure_wit... | [
"0.8478099",
"0.8120963",
"0.81001765",
"0.81001765",
"0.8010885",
"0.7984564",
"0.7981057",
"0.7940716",
"0.79392976",
"0.7935303",
"0.7903023",
"0.7882659",
"0.7882427",
"0.787986",
"0.7873399",
"0.78668606",
"0.78619075",
"0.78619075",
"0.78616524",
"0.7843603",
"0.7843267... | 0.0 | -1 |
Create a hash of options and their values | def options
options = {}
VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, opt... | [
"0.7855381",
"0.7855381",
"0.7855381",
"0.7855381",
"0.783567",
"0.783567",
"0.783567",
"0.783567",
"0.783567",
"0.78323066",
"0.7822982",
"0.7569062",
"0.7561835",
"0.7560454",
"0.7532514",
"0.74730986",
"0.74540573",
"0.7440706",
"0.7437551",
"0.742778",
"0.742778",
"0.74... | 0.6965673 | 68 |
Reset all configuration options to defaults | def reset
self.host = DEFAULT_HOST
self.key = DEFAULT_KEY
self.user_agent = DEFAULT_USER_AGENT
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n @options = defaults\n end",
"def reset!\n @options = defaults\n end",
"def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end",
"def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Co... | [
"0.86164093",
"0.86164093",
"0.8273631",
"0.82638997",
"0.8158281",
"0.8107291",
"0.801208",
"0.799836",
"0.79908955",
"0.79636395",
"0.7944984",
"0.7861677",
"0.78542453",
"0.7811166",
"0.7804713",
"0.7725171",
"0.7723498",
"0.7647931",
"0.76134425",
"0.75961167",
"0.7581861... | 0.0 | -1 |
Normal Character Processing | Overwrite | def process_normal_character(c, pos)
if @anim_type && @anim_type > 0
process_anim_character(c, pos)
else
if WiggleText::GALV_ANI or WiggleText::DROP_IN
@anim_type = 7
process_anim_character(c, pos)
else
super
end
end
wait_for_one_character
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_char(c)\n if c == \"\\000\"\n # Return to original text\n c = \"\\\\\"\n end\n # If \\C[n]\n if c == \"\\001\"\n # Change text color\n @text.sub!(/\\[([0-9]+)\\]/, \"\")\n color = $1.to_i\n if color >= 0 and color <= 7\n self.contents.font.color = text_color... | [
"0.6599264",
"0.6536395",
"0.6529256",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295886",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"0.6295743",
"... | 0.63568836 | 3 |
Animated Character Processing | New Method | def process_anim_character(c, pos)
text_width = text_size(c).width
if defined? Graphics.fullscreen #MKXP fix
text_width += text_width * 0.6
text_width = text_width.round
end
letter = Sprite_TextAnim.new(self.viewport)
bitmap = Bitmap.new(text_width, pos[:height])
letter.bitmap = bitm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_anim_emoji(c, pos)\n text_width = 24\n letter = Sprite_TextAnim.new(self.viewport)\n icon_bitmap = Cache.system(\"Emoji\")\n bitmap = Bitmap.new(24, pos[:height])\n rect = Rect.new(c % 16 * 24, c / 16 * 24, 24, 24)\n bitmap.blt(0, 0, icon_bitmap, rect)\n letter.bitmap = bitmap\n ... | [
"0.7142472",
"0.70955384",
"0.6944911",
"0.69017214",
"0.68905735",
"0.6591027",
"0.65306824",
"0.640214",
"0.6376044",
"0.6305559",
"0.6301024",
"0.6287491",
"0.6222209",
"0.61945015",
"0.61317",
"0.6039888",
"0.6003394",
"0.59743935",
"0.59655726",
"0.5934754",
"0.5916558",... | 0.7768257 | 0 |
Name Menu Processing | New Method | def process_name(c, pos)
c = WiggleText::NAMES[c]
text_width = text_size(c).width
if defined? Graphics.fullscreen #MKXP fix
text_width += text_width * 0.6
text_width = text_width.round
end
letter = Sprite_TextAnim.new(self.viewport)
bitmap = Bitmap.new(text_width, 12)
letter.bitm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_submenu\n\t\tputs \"Enter new list name:\"\n\t\tchoice = get_choice\n\t\t@todo_list.rename_title choice\n\t\tprint_menu\n\tend",
"def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|... | [
"0.70525527",
"0.6986458",
"0.67332244",
"0.6654535",
"0.6644057",
"0.657892",
"0.65383595",
"0.65112466",
"0.64693224",
"0.6416447",
"0.6393381",
"0.6369631",
"0.6309757",
"0.63010037",
"0.62683505",
"0.62530017",
"0.62485534",
"0.62278855",
"0.6203212",
"0.61977",
"0.617103... | 0.0 | -1 |
Animated Emoji Processing | New Method | def process_anim_emoji(c, pos)
text_width = 24
letter = Sprite_TextAnim.new(self.viewport)
icon_bitmap = Cache.system("Emoji")
bitmap = Bitmap.new(24, pos[:height])
rect = Rect.new(c % 16 * 24, c / 16 * 24, 24, 24)
bitmap.blt(0, 0, icon_bitmap, rect)
letter.bitmap = bitmap
letter.x = pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_anim_character(c, pos)\n text_width = text_size(c).width\n if defined? Graphics.fullscreen #MKXP fix\n text_width += text_width * 0.6\n text_width = text_width.round\n end\n letter = Sprite_TextAnim.new(self.viewport)\n bitmap = Bitmap.new(text_width, pos[:height])\n letter.... | [
"0.72375166",
"0.71441704",
"0.6931386",
"0.6913895",
"0.6898102",
"0.6701167",
"0.6408346",
"0.64022315",
"0.62339646",
"0.62240815",
"0.6157888",
"0.6157387",
"0.60825837",
"0.605832",
"0.6000908",
"0.5964467",
"0.58814377",
"0.5865513",
"0.5851776",
"0.5847616",
"0.5838234... | 0.83374417 | 0 |
Animated Character Extra Conditions | New Method | def tuckie_extra(letter)
if WiggleText::DROP_IN
letter.drop = WiggleText::DROP_HEIGHT
else
letter.drop = 0
end
if @anim_type == 5
letter.anim_offset = 0
end
letter.galv_ani = get_galvani
if @rainbow
letter.rainbow = true
letter.rainbow_offset = @animchars.size *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_anim_character(c, pos)\n text_width = text_size(c).width\n if defined? Graphics.fullscreen #MKXP fix\n text_width += text_width * 0.6\n text_width = text_width.round\n end\n letter = Sprite_TextAnim.new(self.viewport)\n bitmap = Bitmap.new(text_width, pos[:height])\n letter.... | [
"0.7175697",
"0.68739814",
"0.68341523",
"0.6803993",
"0.65724385",
"0.6488708",
"0.62718946",
"0.62218165",
"0.599054",
"0.588703",
"0.58535635",
"0.58462036",
"0.58237714",
"0.58055496",
"0.57872367",
"0.57765263",
"0.5745142",
"0.5732984",
"0.5681506",
"0.5678626",
"0.5640... | 0.69818383 | 1 |
Free animated text | New Method | def dispose_text_animation
@animchars.each do |letter|
letter.dispose
end
@animchars = []
@anim_type = 7
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_text_animation()\n unless @animchars.empty?\n @animchars.each do |letter|\n letter.update\n end\n end\n end",
"def animate(text: 'Downloading')\n\tt = Thread.new {\n\t\ti = 0\n\t\tlen = text.length\n\t\tchars = %W(\\u2802 \\u2812 \\u2832 \\u2834 \\u2826)\n\n\t\twhile true\n\t\t... | [
"0.72246444",
"0.685277",
"0.6484646",
"0.63551307",
"0.6352128",
"0.6273817",
"0.6152955",
"0.6149088",
"0.61123896",
"0.6108561",
"0.60915846",
"0.60803044",
"0.6061903",
"0.60061",
"0.59836096",
"0.59525245",
"0.5912002",
"0.5909319",
"0.5898109",
"0.58475953",
"0.58250284... | 0.7822094 | 0 |
Text Animation Processing | New Method | def update_text_animation()
unless @animchars.empty?
@animchars.each do |letter|
letter.update
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_anim_character(c, pos)\n text_width = text_size(c).width\n if defined? Graphics.fullscreen #MKXP fix\n text_width += text_width * 0.6\n text_width = text_width.round\n end\n letter = Sprite_TextAnim.new(self.viewport)\n bitmap = Bitmap.new(text_width, pos[:height])\n letter.... | [
"0.7134264",
"0.70789266",
"0.6873891",
"0.6808889",
"0.6696155",
"0.6578089",
"0.6534557",
"0.639302",
"0.63676363",
"0.6333554",
"0.63184863",
"0.6282286",
"0.6211856",
"0.6149777",
"0.6082641",
"0.6057467",
"0.6054934",
"0.60428977",
"0.60162926",
"0.5958258",
"0.59550786"... | 0.75507236 | 0 |
Description: Given two integers N and M, calculate N Mod M (without using any inbuilt modulus operator). | def n_mod_m x, y
if x < y
return x
end
until x < y do
x = x - y
end
x
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mod(n, m)\n return ((n % m) + m) % m\nend",
"def mod(first_number, second_number)\n first_number % second_number\nend",
"def modular_function\n num_1 % num_2\n return num_1 % num_2\nend",
"def mod(num1, num2)\n num2.to_f % num1.to_f;\nend",
"def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r ... | [
"0.86385137",
"0.76784736",
"0.7502785",
"0.7484294",
"0.7423322",
"0.7094133",
"0.7085913",
"0.70838195",
"0.70515776",
"0.702975",
"0.70226467",
"0.701851",
"0.69843054",
"0.69534075",
"0.69224346",
"0.6850142",
"0.68408626",
"0.6775582",
"0.67489624",
"0.6718386",
"0.66642... | 0.75273013 | 2 |
Creates and initialize new instance of the ServiceClient class. | def initialize(credentials = nil, options = nil)
@credentials = credentials
@request_headers = {}
@middlewares = {middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]}
@user_agent_extended = []
@user_agent_extended.push("ms_rest/#{MsRest::VERSION}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n # Note: Suds logging is disabled\n @soap_client = Suds.client(endpoint: ENDPOINT, namespace: NAMESPACE,\n soap_version: 1, wsdl: WSDL, log: false)\n end",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service... | [
"0.7547454",
"0.75369567",
"0.73749197",
"0.736776",
"0.7240427",
"0.7200181",
"0.7151761",
"0.7151761",
"0.7149154",
"0.70263696",
"0.70196146",
"0.70196146",
"0.70138705",
"0.69987863",
"0.69985807",
"0.69885194",
"0.69873047",
"0.6983889",
"0.6983889",
"0.6983889",
"0.6983... | 0.0 | -1 |
Add additional information into UserAgent header. | def add_user_agent_information(additional_user_agent_information)
@user_agent_extended.push(additional_user_agent_information)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_agent(agent)\n headers.update 'User-Agent' => agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_agent\n end",
"def user_agent=(user_agent)\n @user_agent = user_agent\n @default_headers['User-Agent'] = @user_age... | [
"0.79330176",
"0.73192245",
"0.73192245",
"0.73192245",
"0.73192245",
"0.73192245",
"0.72821367",
"0.72821367",
"0.7233358",
"0.70504755",
"0.7038096",
"0.7038096",
"0.7038096",
"0.6949139",
"0.6898752",
"0.6847055",
"0.6787705",
"0.67355853",
"0.6695944",
"0.6689285",
"0.668... | 0.75718915 | 1 |
Retrieves a new instance of the HttpOperationResponse class. | def create_response(request, http_response, body = nil)
HttpOperationResponse.new(request, http_response, body)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_operation_response\n azure_response = AzureOperationResponse.new(@request, @response, @resource)\n azure_response\n end",
"def create_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query... | [
"0.6100085",
"0.55811495",
"0.5474292",
"0.5471944",
"0.53874326",
"0.5378375",
"0.5179537",
"0.51721865",
"0.5158796",
"0.5134663",
"0.5084847",
"0.5084847",
"0.50721115",
"0.5034034",
"0.50023043",
"0.49800128",
"0.49405918",
"0.49298486",
"0.49238282",
"0.49011803",
"0.487... | 0.7303561 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def todo_params
params.require(:todo).permit(:title, :is_completed, :todo_list_id).merge(todo_list_id: @todo_list.id)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
allow a custom field to be used in a projection, Can either: inject custom arel for a calculated field or use a hint from the field for what additional columns to select for a virtual field | def project_custom_field(_table, column_name)
# two scenarios:
field_type = custom_field_type(column_name)
# 1. this is a calculated column that can be calculated in query
# - then we supply the arel directly here
if field_type == :calculated
calculated = build_custom_calcul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_custom_calculated_field(column_name)\n return unless @custom_fields2.key?(column_name)\n\n @custom_fields2[column_name] => {arel:, type:}\n\n if arel.nil?\n raise CustomErrors::FilterArgumentError,\n \"Custom field #{column_name} is not supported for filtering or ordering\"... | [
"0.6582271",
"0.64881635",
"0.6299785",
"0.6221764",
"0.60678357",
"0.59394294",
"0.5782501",
"0.57527333",
"0.5696884",
"0.56959534",
"0.5680902",
"0.5669111",
"0.5628875",
"0.55910844",
"0.55725783",
"0.5572246",
"0.55395085",
"0.5523345",
"0.54926914",
"0.54921484",
"0.546... | 0.77087355 | 0 |
Add projections to a query. | def apply_projections(query, projections)
new_query = query
projections.each do |projection|
new_query = apply_projection(new_query, projection)
end
new_query
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_projection(query)\n if has_projection_params?\n apply_projections(query, @build.projections(@projection))\n else\n query_projection_default(query)\n end\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fie... | [
"0.72151273",
"0.6815132",
"0.66479295",
"0.662721",
"0.61218804",
"0.5776364",
"0.56271917",
"0.55552715",
"0.55524004",
"0.5463646",
"0.53435075",
"0.5206389",
"0.51594204",
"0.51039696",
"0.5086384",
"0.5086384",
"0.50706065",
"0.50503236",
"0.50480336",
"0.504787",
"0.503... | 0.75251514 | 0 |
Add projection to a query. | def apply_projection(query, projection)
validate_query(query)
validate_projection(projection)
if projection.is_a?(Hash)
expression = projection[:base_table]
projection[:joins].each do |join|
expression = expression.join(join[:arel_table], join[:type]).on(join[:on])
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_projection(query)\n if has_projection_params?\n apply_projections(query, @build.projections(@projection))\n else\n query_projection_default(query)\n end\n end",
"def query_projection_default(query)\n apply_projections(query, @build.projections({ include: @render_fie... | [
"0.7481065",
"0.7005101",
"0.67195004",
"0.6507997",
"0.63189155",
"0.6111984",
"0.58992904",
"0.57991415",
"0.57080376",
"0.548",
"0.548",
"0.5430545",
"0.53938",
"0.5351434",
"0.5351434",
"0.53314674",
"0.5227195",
"0.5159522",
"0.5145117",
"0.51342875",
"0.50975794",
"0.... | 0.68848884 | 2 |
Returns a 4 digit binary code (as a string) representing which attributes are present Bit 1: Issue Bit 2: Project Bit 3: User Bit 4: User type | def sort_code
@sort_code ||= %w(issue_id project_id user_id user_type).map{ |a| self[a].present? ? 1 : 0 }.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_attributes\n puts\n puts @str.tr(NULL, \"!\")\n bit = 1\n 16.times do |bno|\n line = \"\"\n @str.length.times do |i|\n if (@attrs[i] & bit) == 0\n line << \" \"\n else\n if bno.zero?\n line << \"S\"\n else\n line << (\... | [
"0.6455486",
"0.58117694",
"0.57253677",
"0.57225317",
"0.5624025",
"0.56069845",
"0.559811",
"0.55570066",
"0.5554129",
"0.5543393",
"0.55290896",
"0.5514315",
"0.5483094",
"0.5476631",
"0.54693615",
"0.5467571",
"0.5451264",
"0.54477686",
"0.54403025",
"0.5403244",
"0.53561... | 0.0 | -1 |
service = ChaimzService.new service.get_artists service.get_artists.body | def get_artist(id)
@connection.get "artists/#{id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error m... | [
"0.6798373",
"0.6697156",
"0.66373646",
"0.65404874",
"0.6407372",
"0.625659",
"0.61564374",
"0.61516637",
"0.6131982",
"0.6093441",
"0.6056028",
"0.6047297",
"0.60121846",
"0.59982723",
"0.59778357",
"0.5957576",
"0.5938747",
"0.5930546",
"0.5909171",
"0.59022284",
"0.589970... | 0.6338547 | 5 |
service = ChaimzService.new response = service.get_artists service.parse(response) service.parse(response)[10] | def artists_hash
parse(get_artists)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def news artist\n url = \"http://developer.echonest.com/api/v4/artist/news?api_key=#{ECHONEST_API_KEY}&format=json&name=#{artist}&results=#{RESULTS}\"\n result = parseURL url\n result[\"response\"][\"total\"]\nend",
"def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPO... | [
"0.6734168",
"0.6718529",
"0.65346986",
"0.6432002",
"0.6340777",
"0.63274103",
"0.6322494",
"0.63148886",
"0.62776953",
"0.62703943",
"0.6151099",
"0.6112774",
"0.60875446",
"0.60762066",
"0.60735625",
"0.6073358",
"0.60448617",
"0.6040994",
"0.60351515",
"0.6023823",
"0.601... | 0.5908576 | 33 |
Method to show all posts ordered by published date. | def index
per_page = params[:per_page] ? params[:per_page] : Post::PER_PAGE
@posts = Post.by_published_date.paginate(page: params[:page], per_page: per_page)
# Set count of posts and count of pages to query headers
add_headers
render json: @posts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @posts = Post.published.order('published_at DESC')\n end",
"def index\n @posts = Post.order(\"published_at DESC\").all\n end",
"def index\n return @posts = Post.published.paginate(:page => params[:page]).order('id DESC') unless current_user\n @posts = Post.all.paginate(:page => params... | [
"0.7953792",
"0.7888104",
"0.73298323",
"0.72439736",
"0.7229843",
"0.71916944",
"0.7171565",
"0.70963955",
"0.7092228",
"0.70465755",
"0.703539",
"0.70156443",
"0.7009223",
"0.6989793",
"0.6971491",
"0.6952387",
"0.6921715",
"0.69161844",
"0.69132",
"0.68966776",
"0.6892618"... | 0.6964727 | 15 |
Method to create a new users post using the safe params we setup. | def create
@post = current_user.posts.build(post_params)
if params.has_key?(:published_at)
@post.set_time(params[:published_at])
else
@post.set_time(Time.now)
end
if @post.save
render json: @post
else
render json: { errors: @post.errors }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def create\n # post_params is define below\n post = curre... | [
"0.7437732",
"0.74113095",
"0.73770756",
"0.7296459",
"0.7281149",
"0.72772944",
"0.72547686",
"0.7217748",
"0.719206",
"0.71846807",
"0.71558464",
"0.7148501",
"0.7148016",
"0.71439147",
"0.7133696",
"0.71230656",
"0.7066544",
"0.70541215",
"0.7046447",
"0.70393693",
"0.7036... | 0.0 | -1 |
Returns the specified segment leaderboard. | def segment_leaderboard(id_or_options, options = {})
id, options = parse_args(id_or_options, options)
if block_given?
next_page = 1
total_count = 0
loop do
query = options.merge(page: next_page)
response = Strava::Models::SegmentLeader... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaderboard\n\t\tleader_board = $redis_leader_board.zrevrangebyscore('leaderboard',\"+inf\", \"(-inf\", :with_scores => true).collect{|x| {name: x.first, score: x.last}}\n\t\tapi_response(leader_board, 'Leaderboard Scores', :ok)\n\tend",
"def leaderboard(id)\n GameLeaderboard.leaderboard @short_name, id\n... | [
"0.6826507",
"0.65997654",
"0.6482428",
"0.631421",
"0.61214125",
"0.61173284",
"0.6090295",
"0.60849565",
"0.60310215",
"0.6006565",
"0.60033184",
"0.59825474",
"0.5871866",
"0.58495235",
"0.5752196",
"0.5718566",
"0.56124383",
"0.5559658",
"0.55307853",
"0.5450264",
"0.5413... | 0.6481184 | 3 |
List of the authenticated athlete's starred segments. | def starred_segments(options = {}, &block)
paginate 'segments/starred', options, Strava::Models::Segment, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def get_star_list\n args = receive_should_validate?\n get('redtube.Stars.getStarList', {}, [], args[:should_validate])\n end",
"def lists_and_segments\n response = get \"listsandsegmen... | [
"0.6101244",
"0.6059168",
"0.60354275",
"0.60037804",
"0.5886998",
"0.58390945",
"0.5724944",
"0.56063914",
"0.5585026",
"0.55272096",
"0.5438254",
"0.54254025",
"0.54104996",
"0.5360826",
"0.5312873",
"0.52471566",
"0.51229924",
"0.5116113",
"0.51119065",
"0.50969017",
"0.50... | 0.68831456 | 0 |
Returns the specified segment. | def segment(id_or_options, options = {})
id, options = parse_args(id_or_options, options)
Strava::Models::Segment.new(get("segments/#{id}", options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_segment(position)\n @segments[position]\n end",
"def segment\n return asset_on_segment_history.segment rescue nil\n end",
"def segment_0; segments[0]; end",
"def segment(segment)\n { segment: segment }\n end",
"def segment(index)\n if @handle.ptr == nil\n ... | [
"0.7876446",
"0.75655985",
"0.7459654",
"0.7307375",
"0.6693383",
"0.6676556",
"0.6641594",
"0.655793",
"0.64543164",
"0.64538985",
"0.6383392",
"0.6319625",
"0.62919325",
"0.62744844",
"0.6249831",
"0.61983424",
"0.6181065",
"0.61672115",
"0.61580193",
"0.60924184",
"0.60846... | 0.6766155 | 4 |
Stars/Unstars the given segment for the authenticated athlete. | def star_segment(id_or_options, options = {})
id, options = parse_args(id_or_options, options)
throw ArgumentError.new('Required argument :starred missing') if options[:starred].nil?
Strava::Models::Segment.new(put("segments/#{id}/starred", options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starred_segments(options = {}, &block)\n paginate 'segments/starred', options, Strava::Models::Segment, &block\n end",
"def update \n respond_to do |format|\n if @segment.update(segment_params)\n @segment.get_segment_info(session[:access_token])\n @segment.save\n ... | [
"0.59013253",
"0.5789926",
"0.5059892",
"0.50421673",
"0.49593958",
"0.49388215",
"0.48796365",
"0.48602322",
"0.4846237",
"0.48337886",
"0.48309666",
"0.47692224",
"0.47601518",
"0.4736427",
"0.47354132",
"0.4685352",
"0.46567065",
"0.46483812",
"0.46242604",
"0.45896205",
"... | 0.59826803 | 0 |
Force Code Climate to refresh this repository (at the master branch) | def refresh!
output = connection.post resource_refresh_url, :api_token => api_token
output.success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset!\n repo.reset('origin/master', :hard)\n end",
"def refresh\n clone_appium = \"git clone #{clone} #{path}\"\n sh clone_appium unless File.exists? path\n\n sh 'git reset --hard'\n sh 'git fetch --tags'\n\n update_branches\n\n branches.each do |branch|\n sh... | [
"0.70139444",
"0.70024073",
"0.69636106",
"0.6959397",
"0.6959397",
"0.66724515",
"0.6518255",
"0.6509134",
"0.64720094",
"0.64175797",
"0.63878286",
"0.6328743",
"0.6324501",
"0.62892634",
"0.6241546",
"0.622069",
"0.6220438",
"0.620404",
"0.6129121",
"0.6117151",
"0.6117151... | 0.0 | -1 |
Returns an array of contributors | def contributors
has_contributors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contributors\n []\n end",
"def contributors\n return @contributors\n end",
"def contributor_names\n @contributor_names ||= contributors.map {|c| c.realname || c.username }\n end",
"def contributor_usernames\n @contributor_usernames ||= contributors.map(&:usern... | [
"0.8854907",
"0.8265163",
"0.81641513",
"0.7993134",
"0.7957331",
"0.7953479",
"0.7876127",
"0.7717057",
"0.7681408",
"0.7629166",
"0.7503834",
"0.74043643",
"0.73552614",
"0.7351048",
"0.7231033",
"0.70730305",
"0.70224094",
"0.6941075",
"0.69201076",
"0.68855226",
"0.684413... | 0.69793093 | 17 |
Define a new attribute for this record. | def attribute name, type, options = {}
header.push(attribute = type.new(self, name, options))
define_singleton_method(name, lambda{ attribute })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_attribute(name, value); end",
"def attribute name, *attr\n\n # Add the attribute\n _attr = AttributeDefinition.new( name, *attr )\n attribute_definitions << _attr\n\n # Inject object with getter and setter for attribute\n define_setter_and_getter(name, _attr)\n end",
"def de... | [
"0.7337956",
"0.7239378",
"0.7217736",
"0.7216748",
"0.7208325",
"0.7162862",
"0.7097459",
"0.6954612",
"0.6920479",
"0.69076717",
"0.6905958",
"0.6905811",
"0.6860187",
"0.6815459",
"0.6790567",
"0.67790526",
"0.67790526",
"0.6764367",
"0.6741454",
"0.67386013",
"0.6733746",... | 0.0 | -1 |
Define the store (table). | def store name = nil
name ? @store = name : @store
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store\n @store ||= Store.new\n end",
"def store=(store)\n @store = store\n end",
"def initialize\n @store = {}\n end",
"def store\n @store ||= {}\n end",
"def store; end",
"def store; end",
"def store; end",
"def initialize( store )\n @store = store\n e... | [
"0.6851161",
"0.6751608",
"0.6687856",
"0.6685646",
"0.66827726",
"0.66827726",
"0.66827726",
"0.6656795",
"0.6622134",
"0.66194266",
"0.660718",
"0.6597277",
"0.65411353",
"0.6533062",
"0.652014",
"0.652014",
"0.65037197",
"0.6478427",
"0.6475024",
"0.6441056",
"0.64307857",... | 0.62205625 | 43 |
GET /cap_dates/1 GET /cap_dates/1.json | def show
@cap_date = CapDate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @cap_date }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @cap_date = CapDate.new\n @title = 'New CAP Date'\n @description = 'Add a new CAP date'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cap_date }\n end\n end",
"def calories_on_date(date)\n get_call(\"1/user/#{user_id}/activitie... | [
"0.64313006",
"0.6128546",
"0.61162835",
"0.6107388",
"0.6093211",
"0.60873055",
"0.60675734",
"0.60671955",
"0.60612696",
"0.60525435",
"0.60268694",
"0.5989807",
"0.5884064",
"0.5839503",
"0.58282626",
"0.58282626",
"0.58129185",
"0.5774495",
"0.5762973",
"0.5729177",
"0.57... | 0.7581553 | 0 |
GET /cap_dates/new GET /cap_dates/new.json | def new
@cap_date = CapDate.new
@title = 'New CAP Date'
@description = 'Add a new CAP date'
respond_to do |format|
format.html # new.html.erb
format.json { render json: @cap_date }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entry = Entry.new(dob: Date.new(Date.today.year - 18, 1, 1))\n get_events\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end",
"def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_... | [
"0.7014962",
"0.6867351",
"0.68628657",
"0.68040633",
"0.6795836",
"0.6759331",
"0.675374",
"0.6693109",
"0.66915244",
"0.66666454",
"0.6613252",
"0.65900344",
"0.6587289",
"0.65223163",
"0.64917535",
"0.6466331",
"0.646127",
"0.6444812",
"0.64435905",
"0.64185286",
"0.641655... | 0.8005217 | 0 |
POST /cap_dates POST /cap_dates.json | def create
@cap_date = CapDate.new(params[:cap_date])
@cap_date.affiliate_id = params[:affiliate_id]
@isfacultyflag = Affiliate.find(params[:affiliate_id]).isfaculty
if @isfacultyflag
@pidm = Affiliate.find(params[:affiliate_id]).pidm
end
respond_to do |format|
if @cap_date.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dates(options = {})\n response= handle_errors{ self.class.get('/dates', :query => options)}\n response[\"dates\"][\"date\"].collect{|i| Rubycious::PostDate.new(i)}\n end",
"def new\n @cap_date = CapDate.new\n @title = 'New CAP Date'\n @description = 'Add a new CAP date'\n\n resp... | [
"0.6122649",
"0.60204417",
"0.59364194",
"0.5825478",
"0.578119",
"0.5775604",
"0.57640636",
"0.57011527",
"0.5689475",
"0.56862754",
"0.5680282",
"0.5672004",
"0.5653628",
"0.5616847",
"0.56039625",
"0.5584076",
"0.5578113",
"0.5569508",
"0.5558158",
"0.55576617",
"0.5553194... | 0.61973625 | 0 |
PUT /cap_dates/1 PUT /cap_dates/1.json | def update
@cap_date = CapDate.find(params[:id])
@isfacultyflag = Affiliate.find(params[:affiliate_id]).isfaculty
if @isfacultyflag
@pidm = Affiliate.find(params[:affiliate_id]).pidm
end
respond_to do |format|
if @cap_date.update_attributes(params[:cap_date])
if @isfacultyfla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n us... | [
"0.6155523",
"0.6144686",
"0.5807066",
"0.5800671",
"0.57883036",
"0.572141",
"0.57200885",
"0.5679393",
"0.5659853",
"0.5654659",
"0.56516385",
"0.5648035",
"0.56419265",
"0.5635938",
"0.5626096",
"0.5623993",
"0.5620588",
"0.5607507",
"0.560021",
"0.5557651",
"0.55515945",
... | 0.63298213 | 0 |
DELETE /cap_dates/1 DELETE /cap_dates/1.json | def destroy
@cap_date = CapDate.find(params[:id])
@cap_date.destroy
@isfacultyflag = Affiliate.find(params[:affiliate_id]).isfaculty
if @isfacultyflag
@pidm = Affiliate.find(params[:affiliate_id]).pidm
end
respond_to do |format|
if @isfacultyflag
format.html { redirect_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_to important_dates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expiration_date = ExpirationDate.find(params[:id])\n @expiration_date.destroy\n\n respond_to do |format|\n... | [
"0.7112114",
"0.68302727",
"0.68075645",
"0.6761119",
"0.67312044",
"0.67290884",
"0.66291386",
"0.6627017",
"0.66104615",
"0.6610369",
"0.6593151",
"0.6585726",
"0.65767586",
"0.6563991",
"0.65606815",
"0.6542317",
"0.65242237",
"0.65188104",
"0.65107894",
"0.6494958",
"0.64... | 0.6562698 | 14 |
BLOCK Copyright Mark Keane, All Rights Reserved, 2013 | def block_eg
puts "this is the first message"
yield
puts "this is the middle message"
yield
puts "this is the last\n\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197",
"0.70646197"... | 0.0 | -1 |
== Particle Event Routes == | def pump
if event_params(:pump)['event'].present? && event_params(:pump)['event'].start_with?('pump')
@pump_status = PumpStatus.new event_params(:pump)
handle_event(@pump_status)
else
handle_event_missing(event_params(:name))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_walk_particle()\n\n end",
"def postroute\n community.messages.map{|m| m.ressource.postroute ? m : nil}.compact.each do |msg|\n messages << msg\n Event.make(:event_type_name => EvType.find_by_name(\"created\").name, :participant => participant, :message => msg)\n logger.info \"**** p... | [
"0.6067038",
"0.58016425",
"0.5602329",
"0.54260373",
"0.54260373",
"0.54260373",
"0.54260373",
"0.54260373",
"0.54260373",
"0.54260373",
"0.54260373",
"0.5375811",
"0.53217196",
"0.527183",
"0.5233269",
"0.5212587",
"0.51960695",
"0.51960695",
"0.51960695",
"0.5179732",
"0.5... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_rhizome
@rhizome = Rhizome.find(params[:rhizome_id]) unless params[:rhizome_id].to_i.zero?
@rhizome = Rhizome.find(params[:rhizome].to_i) unless params[:rhizome].nil?
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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Strong parameter requirements to be enforced when creating an EquipmentStatus | def event_params(event)
json_params = ActionController::Parameters.new particle_json
json_params.permit(send("#{event}_task_params"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equipment_status_params\n params.require(:equipment_status).permit(:equipment_status)\n end",
"def status_params\n params.require(:status).permit(:available)\n end",
"def check_vehicle_status_params\n params.require(:check_vehicle_status).permit(:name, :description)\n end",
"def s... | [
"0.7356275",
"0.6950838",
"0.6551879",
"0.6517479",
"0.65037215",
"0.6500081",
"0.64980966",
"0.64907867",
"0.64677304",
"0.64677167",
"0.6466587",
"0.6459146",
"0.6433352",
"0.64111036",
"0.64102453",
"0.6400281",
"0.63823617",
"0.6382255",
"0.63792956",
"0.6358624",
"0.6347... | 0.0 | -1 |
Gets the hooks that report as belonging to a given device | def associated_hooks(particle_client, device_id)
particle_client.webhooks.select { |wh| wh if (wh.deviceID == device_id) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hooks\n @hooks = Hook.all\n end",
"def hooks\n @hooks ||= []\n end",
"def hooks\n @hooks ||= Hash.new([])\n end",
"def hooks\n @hooks ||= Hash.new { |h, k| h[k] = [] }\n end",
"def report_hooks(element, tag)\n (element[tag] || []).map do |hook|\n Repo... | [
"0.6644352",
"0.6538703",
"0.64720315",
"0.6363588",
"0.6356191",
"0.62283576",
"0.6206225",
"0.6089814",
"0.6081826",
"0.60451764",
"0.6033582",
"0.59979546",
"0.5997182",
"0.599658",
"0.59837574",
"0.5910268",
"0.58977824",
"0.58469725",
"0.5709956",
"0.5700144",
"0.566877"... | 0.6947509 | 0 |
GET /simple_events GET /simple_events.xml | def index
#@simple_events = SimpleEvent.all
redirect_to :action=> "new"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def show\n @simple_event = SimpleEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simple_event }\n end\n end",
"def get_events()\n @client... | [
"0.7459294",
"0.7321372",
"0.70962626",
"0.70919675",
"0.7000729",
"0.69721234",
"0.69484013",
"0.68237555",
"0.68211466",
"0.6804244",
"0.6804244",
"0.6804244",
"0.6804244",
"0.6785169",
"0.6774273",
"0.6759947",
"0.67171055",
"0.6704183",
"0.668942",
"0.6689302",
"0.666738"... | 0.0 | -1 |
GET /simple_events/1 GET /simple_events/1.xml | def show
@simple_event = SimpleEvent.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @simple_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events ... | [
"0.7064806",
"0.70362234",
"0.699911",
"0.6896748",
"0.6811875",
"0.67242324",
"0.67131627",
"0.6703843",
"0.6690799",
"0.6690799",
"0.6690799",
"0.6690799",
"0.66748077",
"0.66576695",
"0.66571516",
"0.6636635",
"0.6630833",
"0.6623826",
"0.6573914",
"0.6563454",
"0.6550633"... | 0.7325281 | 0 |
GET /simple_events/new GET /simple_events/new.xml | def new
@simple_event = Event.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @simple_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render ... | [
"0.77744275",
"0.77198863",
"0.76074815",
"0.75946516",
"0.7574596",
"0.7572667",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.75654066",
"0.7564307",
... | 0.8028757 | 0 |
POST /simple_events POST /simple_events.xml | def create
@simple_event = Event.create(params[:event])
#create a ci object
ci = ContactInfo.create :name => @simple_event.contact_name, :phone => @simple_event.contact_phone, :email => @simple_event.contact_email
@simple_event.contact_info = ci
search_types = params[:search_request]['types']
cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n ... | [
"0.6748099",
"0.65689325",
"0.6370736",
"0.6343654",
"0.63134706",
"0.62960964",
"0.62770504",
"0.6199201",
"0.6199201",
"0.6199201",
"0.6199201",
"0.6199201",
"0.61961657",
"0.61961657",
"0.61961657",
"0.61961657",
"0.6186853",
"0.6166747",
"0.6154983",
"0.614876",
"0.613625... | 0.0 | -1 |
Installs the latest version of the named package | def install(packagename, force=false)
packagename.strip!()
# FIXME - check to see if it is already installed
Cfruby.controller.attempt("Installing \"#{packagename}\"", 'destructive', 'unknown', 'install') {
`#{@rpmbin} -i '#{packagename.gsub(/(\')/, "\\\1")}'`
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_package(name, version)\n package_provider.install_package\n end",
"def update\n install\n end",
"def install_package host, package_name, package_version = nil\n host.install_package package_name, '', package_version\n end",
"def install\n bin.install \"#{PAC... | [
"0.7562306",
"0.72955555",
"0.703563",
"0.70178974",
"0.6972239",
"0.6972239",
"0.6862744",
"0.6802184",
"0.67276275",
"0.67270327",
"0.67270327",
"0.6656553",
"0.6587365",
"0.65871423",
"0.6585283",
"0.65471447",
"0.65370184",
"0.6531524",
"0.6512331",
"0.64838195",
"0.64699... | 0.6346593 | 32 |
Uninstalls the named package | def uninstall(packagename)
pacakgename.strip!()
Cfruby.controller.attempt("Uninstalling \"#{packagename}\"", 'destructive', 'unknown') {
`#{@rpmbin} -e #{packagename}`
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uninstall_package host, package_name\n host.uninstall_package package_name\n end",
"def uninstall(packagename)\n\t\t\tend",
"def uninstall(packagename)\n\t\t\t\tpacakgename.strip!()\n\n\t\t\t\tCfruby.controller.attempt(\"Uninstalling \\\"#{packagename}\\\"\", 'destructive', 'unknown') {\n\t... | [
"0.85242915",
"0.8222553",
"0.8082116",
"0.8043201",
"0.80169374",
"0.75620484",
"0.7467732",
"0.7444671",
"0.7444671",
"0.7444671",
"0.74184483",
"0.7406317",
"0.71440935",
"0.7141094",
"0.7133962",
"0.70855904",
"0.7083366",
"0.70749277",
"0.7054054",
"0.7037558",
"0.701002... | 0.7985451 | 5 |
Returns a PackageList object that contains key value pairs for every installed package where the key is the package name and the value is the currently installed version. See PackageList for more information | def installed_packages()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].... | [
"0.80905014",
"0.79638135",
"0.79024947",
"0.75996655",
"0.69909906",
"0.6684052",
"0.6684052",
"0.6684052",
"0.66359556",
"0.6609759",
"0.65107733",
"0.6439457",
"0.6396089",
"0.63673735",
"0.6257469",
"0.6225695",
"0.62032175",
"0.6164112",
"0.61319286",
"0.60642314",
"0.60... | 0.587817 | 31 |
Returns a PackageList object that contains key value pairs for every package (installed or not) where the key is the package name and the value is a PackageInfo object | def packages()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].... | [
"0.80706483",
"0.7954711",
"0.78840816",
"0.7785748",
"0.7218957",
"0.71232396",
"0.66424054",
"0.6488942",
"0.64663297",
"0.6445628",
"0.6422216",
"0.63506204",
"0.63506204",
"0.63186467",
"0.6245592",
"0.6212432",
"0.6198807",
"0.6132263",
"0.6120623",
"0.6077938",
"0.60646... | 0.0 | -1 |
POST /cars git commit amend resetauthor | def create
@car = Car.new(car_params)
if @car.save
redirect_to @car, notice: 'Car was successfully created.'
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(name, message)\n git = git(name)\n\n git.config('user.name', GIT_AUTHOR[:name])\n git.config('user.email', GIT_AUTHOR[:email])\n\n git.add(all: true)\n git.commit(message)\n end",
"def git_commit_initial\n author = {:email => \"admin@localhost\", :name => \"admin\", :time => Tim... | [
"0.5550377",
"0.55413246",
"0.5514748",
"0.5512641",
"0.55029804",
"0.54704815",
"0.5436062",
"0.54328245",
"0.54188704",
"0.5341609",
"0.53300554",
"0.53234625",
"0.53234625",
"0.53205466",
"0.52850306",
"0.5270189",
"0.52386093",
"0.52369064",
"0.52178293",
"0.52174634",
"0... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_car
@car = Car.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def car_params
params.require(:car).permit(:model, :style, :licencePlateNum, :location, :status, :manufacturer, :hourlyRentalRate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
This is called on Admin::Mergesnew | def validate_klass!
raise "type can't be blank" unless type.present?
raise 'type must be a mergable type' unless EffectiveMergery.mergables.map(&:name).include?(type)
raise "invalid ActiveRecord klass" unless klass
raise "invalid ActiveRecord collection" unless collection.kind_of?(ActiveRecord::... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_merge\n @admin_merge = Admin::Merge.find(params[:id])\n end",
"def create\n @admin_merge = Admin::Merge.new(merge_params)\n\n respond_to do |format|\n if @admin_merge.save\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully created.' }\n format.json ... | [
"0.683974",
"0.66982347",
"0.6697759",
"0.6665877",
"0.66172653",
"0.6612678",
"0.6356897",
"0.6155052",
"0.6096396",
"0.6096396",
"0.60500675",
"0.60499465",
"0.60173714",
"0.59767854",
"0.59400046",
"0.5936335",
"0.5930835",
"0.5925452",
"0.592099",
"0.59193015",
"0.5919301... | 0.0 | -1 |
authorize_resource :class => false GET /asformularies GET /asformularies.json | def index
#@asformularies = Asformulary.all
#@asformulary = Asformulary.new(:rut_atendido => params[:rut_atendido])
@results = Asformulary.search(params[:search]).order('created_at DESC')
#puts @results[0].rut_atendido
#puts @results.count
puts params[:search]
#puts params[:asformulary][:rut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n authorize @application_form\n render json: @application_form\n end",
"def show\n #@admission_category = AdmissionCategory.find(params[:id])\n #load_and_authorize_resource will load the object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: ... | [
"0.6911695",
"0.6636242",
"0.6631369",
"0.65398055",
"0.6509008",
"0.6496995",
"0.64948255",
"0.64700365",
"0.646522",
"0.6413598",
"0.63985175",
"0.63434315",
"0.6312513",
"0.62955076",
"0.62955076",
"0.6215285",
"0.621294",
"0.6198088",
"0.61880475",
"0.61880475",
"0.618804... | 0.0 | -1 |
GET /asformularies/1 GET /asformularies/1.json | def show
if(params[:cerrar])
theasformulary = Asformulary.find(params[:id])
if theasformulary.estado != true
theasformulary.estado = true
theasformulary.save
end
redirect_to asformulary_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def show\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.j... | [
"0.7715325",
"0.6949727",
"0.65459526",
"0.6534755",
"0.6516807",
"0.65064585",
"0.65011084",
"0.6491988",
"0.6475528",
"0.64390486",
"0.6333657",
"0.6263788",
"0.62245023",
"0.6204101",
"0.6181396",
"0.6172173",
"0.6157925",
"0.61223525",
"0.6115594",
"0.6083647",
"0.6080774... | 0.0 | -1 |
POST /asformularies POST /asformularies.json | def create
if (params[:check])
redirect_to new_asformulary_path#(rut_atendido: params[:asformulary][:rut_atendido])
else
@asformulary = Asformulary.new(asformulary_params)
@asformulary.lyduser = current_lyduser
@asformulary.user_id = 1
respond_to do |format|
if @asformula... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_... | [
"0.6296",
"0.61823726",
"0.598676",
"0.5963984",
"0.5912559",
"0.5883112",
"0.58072877",
"0.57363766",
"0.5726363",
"0.5686521",
"0.56551844",
"0.5581038",
"0.55710506",
"0.5516213",
"0.5461575",
"0.544474",
"0.54381126",
"0.5429157",
"0.54165083",
"0.5416178",
"0.5411083",
... | 0.54121524 | 20 |
PATCH/PUT /asformularies/1 PATCH/PUT /asformularies/1.json | def update
respond_to do |format|
if @asformulary.update(asformulary_params)
format.html { redirect_to @asformulary, notice: 'Asformulary was successfully updated.' }
format.json { render :show, status: :ok, location: @asformulary }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render act... | [
"0.6896544",
"0.66376454",
"0.63175875",
"0.62099904",
"0.6172068",
"0.6117942",
"0.610024",
"0.60763186",
"0.60558385",
"0.60252786",
"0.60204405",
"0.6019225",
"0.601757",
"0.60157704",
"0.60032153",
"0.5990437",
"0.5990325",
"0.59854734",
"0.5984118",
"0.5972342",
"0.59683... | 0.6681759 | 1 |
DELETE /asformularies/1 DELETE /asformularies/1.json | def destroy
@asformulary.destroy
respond_to do |format|
format.html { redirect_to asformularies_url, notice: 'Asformulary was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @formulary.user_id == current_user.id\n @formulary.destroy\n ... | [
"0.76926786",
"0.71464264",
"0.70796835",
"0.7045067",
"0.70353556",
"0.70191956",
"0.70191",
"0.7002458",
"0.6994651",
"0.69917",
"0.69872403",
"0.6986657",
"0.696457",
"0.6962019",
"0.6953205",
"0.69497156",
"0.69334805",
"0.68915176",
"0.6888767",
"0.68817085",
"0.688127",... | 0.7527373 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_asformulary
@asformulary = Asformulary.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def asformulary_params
params.require(:asformulary).permit(:rut_atendido, :codigo_obra, :user_id, :nombre_atendido, :apellido_paterno, :apellido_materno, :aspcategory_id, :solucion, :estado, :subcontrato, :nombre_supervisor, :descripcion, :telefono, :benefit_id, :atencion_id, :numero_atencion, :lyduser_id)
en... | {
"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 |
Test that the relationship between a page_ref and its site is consistent Providing a site parameter asserts that the given site DOES belong to the page_ref | def assert_page_ref_correctness page_ref, site=page_ref.site
assert_equal site, page_ref.site, 'Site not associated with page_ref'
# The page_ref has a site
assert_not_nil site
# The site's page_refs includes the page_ref
assert site.page_refs.include?(page_ref), "Site misses a page_ref that refers ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_referent rft\n return unless rft\n unless referents.exists?(id: rft.id)\n self.referents << rft\n # Saving the page_ref appears to be the only way to ensure that the list of referents is current\n save\n end\n end",
"def content_should_be_in_same_site\n errors.add(:content,... | [
"0.59000987",
"0.5570201",
"0.5409765",
"0.54069424",
"0.5397967",
"0.53014076",
"0.52995104",
"0.52515197",
"0.52261436",
"0.52255774",
"0.5196043",
"0.51797986",
"0.5153119",
"0.5121998",
"0.51040304",
"0.51027",
"0.5099376",
"0.50982314",
"0.50759506",
"0.50727123",
"0.507... | 0.84634924 | 0 |
GET /instances/1 GET /instances/1.json | def show
@instance = Instance.find_by_id( params[:id] )
@image = Image.find_by_ami(@instance.image_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end",
"def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return insta... | [
"0.736618",
"0.7214309",
"0.7158011",
"0.7146121",
"0.7112613",
"0.7072681",
"0.6925807",
"0.6900372",
"0.6879555",
"0.6874284",
"0.68677473",
"0.679019",
"0.67767614",
"0.676594",
"0.67317724",
"0.6722368",
"0.6722368",
"0.65890914",
"0.65742576",
"0.6562376",
"0.6550179",
... | 0.5888825 | 57 |
return auth token once user is authenticated | def authenticate
user = User.find_by(email: params[:email].to_s.downcase)
if user && user.authenticate(params[:password])
auth_token = JsonWebToken.encode({user_id: user.id})
render json: {auth_token: auth_token, user: user}, status: :ok
else
render json: {error: 'Invalid username / passw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n authenticated\n end",
"def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end",
"def auth_token\n @@auth_token\n end",
"def auth_token\n @auth_token ||= ActionController::HttpAuthentication::Token.token_and_options... | [
"0.8566854",
"0.8064737",
"0.8033954",
"0.79527634",
"0.7943687",
"0.78708583",
"0.78672314",
"0.78335124",
"0.78012806",
"0.7775932",
"0.7731353",
"0.7702829",
"0.770254",
"0.7683289",
"0.7671233",
"0.7641405",
"0.76181334",
"0.7576367",
"0.75748855",
"0.7573644",
"0.7554436... | 0.0 | -1 |
format a float as decimal with same precision as mileage | def db_formatted_km_len( f, long = true )
return if f.nil?
if long
number_with_precision( f, precision: 3, separator: '.', delimiter: ' ' )
else
number_with_precision( f, precision: 0, delimiter: ' ')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_with_precision\n\t\t\"%.2f\" % number\n\tend",
"def FormatFloat(value)\n return '%.1f' % value\n end",
"def to_format(value, currency)\n format(\"%.#{precision(currency)}f\", value.to_f)\n end",
"def number_with_precision(number, precision=3)\n \"%01.#{precision}f\" % number\n ... | [
"0.7172286",
"0.7072127",
"0.69829357",
"0.6933186",
"0.68726647",
"0.68501705",
"0.68038416",
"0.67276925",
"0.6668908",
"0.66592616",
"0.66374975",
"0.66335577",
"0.6631422",
"0.6625265",
"0.66245204",
"0.66207117",
"0.6588281",
"0.6564815",
"0.6519335",
"0.6501545",
"0.648... | 0.0 | -1 |
GET /savings or /savings.json | def index
@savings = Saving.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def show\n @savings = Savings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { r... | [
"0.7045585",
"0.68190485",
"0.6122754",
"0.6093189",
"0.6083661",
"0.60720485",
"0.60316354",
"0.6025829",
"0.6025829",
"0.6025829",
"0.60210294",
"0.5992713",
"0.5987364",
"0.59793663",
"0.5974508",
"0.5973234",
"0.595912",
"0.5942395",
"0.59418803",
"0.5934612",
"0.5919952"... | 0.6754219 | 2 |
GET /savings/1 or /savings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @savings = Savings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { r... | [
"0.6894341",
"0.6859528",
"0.6440335",
"0.60660666",
"0.59731233",
"0.5922378",
"0.5883586",
"0.58653307",
"0.58595467",
"0.58587843",
"0.585044",
"0.5842534",
"0.5834392",
"0.5798492",
"0.5790022",
"0.5788563",
"0.5787824",
"0.57752675",
"0.57752675",
"0.57752675",
"0.577508... | 0.0 | -1 |
POST /savings or /savings.json | def create
@saving = Saving.new(saving_params)
respond_to do |format|
if @saving.save
format.html { redirect_to @saving, notice: "Saving was successfully created." }
format.json { render :show, status: :created, location: @saving }
else
format.html { render :new, status: :un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @savings = Savings.new(params[:savings])\n\n respond_to do |format|\n if @savings.save\n flash[:notice] = 'Savings was successfully created.'\n format.html { redirect_to(@savings) }\n format.xml { render :xml => @savings, :status => :created, :location => @savings }\n ... | [
"0.70414275",
"0.6320542",
"0.60135937",
"0.6012653",
"0.5971395",
"0.59679055",
"0.5931769",
"0.5912283",
"0.58858395",
"0.5861579",
"0.58302605",
"0.5824537",
"0.58189446",
"0.5760125",
"0.5753642",
"0.5685969",
"0.56755656",
"0.56655854",
"0.5663249",
"0.5648773",
"0.56282... | 0.6822876 | 1 |
PATCH/PUT /savings/1 or /savings/1.json | def update
respond_to do |format|
if @saving.update(saving_params)
format.html { redirect_to @saving, notice: "Saving was successfully updated." }
format.json { render :show, status: :ok, location: @saving }
else
format.html { render :edit, status: :unprocessable_entity }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @savings = Savings.find(params[:id])\n\n respond_to do |format|\n if @savings.update_attributes(params[:savings])\n flash[:notice] = 'Savings was successfully updated.'\n format.html { redirect_to(@savings) }\n format.xml { head :ok }\n else\n format.html {... | [
"0.71691734",
"0.66892767",
"0.65841603",
"0.63253385",
"0.62356335",
"0.6163591",
"0.61554277",
"0.6128329",
"0.60994357",
"0.6061795",
"0.6023331",
"0.60105526",
"0.59845096",
"0.5984308",
"0.59670126",
"0.5959813",
"0.5956782",
"0.5939103",
"0.5934294",
"0.59252894",
"0.59... | 0.6595796 | 2 |
DELETE /savings/1 or /savings/1.json | def destroy
@saving.destroy
respond_to do |format|
format.html { redirect_to savings_url, notice: "Saving was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @savings = Savings.find(params[:id])\n @savings.destroy\n\n respond_to do |format|\n format.html { redirect_to(savings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @saving.destroy\n respond_to do |format|\n format.html { redirect_to savings_url, n... | [
"0.7464287",
"0.70497644",
"0.6821227",
"0.6399374",
"0.63833994",
"0.6338314",
"0.6337428",
"0.63293064",
"0.62948495",
"0.62895375",
"0.62592447",
"0.62454426",
"0.62441385",
"0.6238312",
"0.6229775",
"0.6219716",
"0.6214791",
"0.62020546",
"0.61996603",
"0.61996603",
"0.61... | 0.70402706 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_saving
@saving = Saving.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.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def saving_params
params.require(:saving).permit(:status, :interest_rate)
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.6950644",
"0.68134046",
"0.68034387",
"0.6796522",
"0.674668",
"0.6742105",
"0.6527854",
"0.65214247",
"0.6491907",
"0.64294493",
"0.64294493",
"0.64294493",
"0.64004904",
"0.6356768",
"0.63556653",
"0.6348119",
"0.6344521",
"0.63386923",
"0.632588",
"0.632588",
"0.632588"... | 0.0 | -1 |
Punctuation is not part of the word unless it is a contraction. In order to not have to write an actual language parser, there won't be any punctuation too complex. There will be no "'" that is not part of a contraction. | def alternate_words(string)
# clean_string gets rid of ! @ $ # % ^ & * ( ) - = _ .....
clean_string = string.to_s.gsub(/[^’'A-Za-z0-9\s]/i,' ')
#array then turns clean_string into an array of words split using the space character
clean_string_array = clean_string.split(" ")
#create a new array called fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_word?\n not is_punctuation?\n end",
"def is_punctuation?(str)\n %w(. , ? ! ; :).include?(str)\n end",
"def is_punctuation?\n %w(. ,).include?(wordform)\n end",
"def strip_punctuation(word)\n punctuation_stripping_regexp = /(.+)([^.,?!-_+=@#$%^&*()])/\n word.match(punctuation_stripping_re... | [
"0.7233627",
"0.6944324",
"0.69012624",
"0.6648974",
"0.6598853",
"0.6580101",
"0.65181845",
"0.64396214",
"0.6418581",
"0.64009494",
"0.6367586",
"0.6229629",
"0.62260216",
"0.6173319",
"0.61195683",
"0.61055243",
"0.6044681",
"0.60445374",
"0.6039605",
"0.60187715",
"0.6006... | 0.0 | -1 |
Returns true if the set and the given set have no element in common. This method is the opposite of intersect?. | def disjoint?(set)
!intersect?(set)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disjoint?(set)\n !intersect?(set)\n end",
"def disjoint?(set)\n !intersect?(set)\n end",
"def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end",
"def intersect?(other_set)\n requires_set(other_set, __method__)\n intersection(other_set).any?\n end",
"def intersect?(set)\n ... | [
"0.83751154",
"0.83751154",
"0.7203435",
"0.7045834",
"0.6718243",
"0.6642182",
"0.65460753",
"0.6470176",
"0.64571095",
"0.6394943",
"0.6381723",
"0.6352904",
"0.62921935",
"0.62645274",
"0.6231271",
"0.62154377",
"0.6204431",
"0.6172924",
"0.6169834",
"0.6146678",
"0.611173... | 0.8425697 | 0 |
}}} We're really only concerned about win32ole, so we focus our check on its ability to load that | def is_windows? # {{{
return @is_win if @is_win
begin
require "win32ole"
rescue LoadError
end
@is_win ||= Object.const_defined?("WIN32OLE")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ole_obj\n is_ok = true\n begin\n @ole_obj.Name\n rescue => e\n is_ok = false\n end\n\n binding.break unless is_ok || drawing_closed?\n\n @ole_obj\n end",
"def is_windows?\n return @is_windows unless @is_windows.nil?\n\n require 'win32ole'\n ... | [
"0.6200141",
"0.5586854",
"0.5471822",
"0.5410766",
"0.5410018",
"0.53282845",
"0.52370214",
"0.50847024",
"0.4972275",
"0.4954843",
"0.4953795",
"0.493553",
"0.4921128",
"0.49037364",
"0.48925468",
"0.48378393",
"0.4824399",
"0.48203734",
"0.4817172",
"0.47725153",
"0.476174... | 0.5583724 | 2 |
}}} Find the path to rackup, by searching for R (undocumented cli argument), then checking RUBYLIB for the _first_ rack it can find there, finally falling back to gems and looking for rackup in the gem bindir. If we can't find rackup we're raising; not even usage is sane without rackup. | def rackup_path # {{{
return @rackup_path if @rackup_path
# Use the supplied path if the user supplied -R
if path_supplied = ARGV.delete("-R")
@rackup_path = ARGV.delete(@ourargs[@ourargs.index("-R") + 1])
if @rackup_path and File.file?(@rackup_path)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rackup_path\n return @rackup_path if @rackup_path\n\n @rackup_path =\n rackup_path_from_argv ||\n rackup_path_from_which ||\n rackup_path_from_rubylib ||\n rackup_path_from_rubygems\n\n if @rackup_path\n @rackup_path\n else\n rai... | [
"0.75600463",
"0.730697",
"0.6830141",
"0.62378275",
"0.61733466",
"0.589105",
"0.5878134",
"0.5796772",
"0.53433865",
"0.532523",
"0.532523",
"0.5313706",
"0.5237353",
"0.51309097",
"0.5082916",
"0.49960968",
"0.48927358",
"0.48832318",
"0.48289895",
"0.48047066",
"0.4802881... | 0.79323775 | 0 |
Returns true if the mouse is currently over the controller's component object, false or nil otherwise. | def over?
if controller.contains?(*controller.translate_absolute(x, y))
# the event occurred within this component's local space
@over = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse?\n instance.options[:mouse]\n end",
"def mouse_over?\n return @window.mouse_x.between?(@x, @x+@width) && @window.mouse_y.between?(@y, @y+@height)\n end",
"def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PAD... | [
"0.74785334",
"0.7284528",
"0.70167226",
"0.6897235",
"0.6893198",
"0.6863043",
"0.68434983",
"0.68163085",
"0.68145126",
"0.68145126",
"0.67911655",
"0.66624135",
"0.6610267",
"0.65411866",
"0.652688",
"0.6475327",
"0.6449213",
"0.64486",
"0.6407859",
"0.6388601",
"0.6362244... | 0.8047738 | 0 |
Test if a given flavor exists | def has_flavor?(flavor_name)
flavors.has_key?(flavor_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flavor f\n @logger.debug \"OpenStack: Looking up flavor '#{f}'\"\n @compute_client.flavors.find { |x| x.name == f } || raise(\"Couldn't find flavor: #{f}\")\n end",
"def package_in_flavor?(pkg, flavor_name)\n flavor_def = flavor_by_name(flavor_name)\n if pkg.respond_to?(:na... | [
"0.7316227",
"0.6998292",
"0.6951151",
"0.6712795",
"0.6670609",
"0.64758706",
"0.6461938",
"0.6368715",
"0.62840444",
"0.62544334",
"0.62447",
"0.6214182",
"0.61657476",
"0.61649877",
"0.6130646",
"0.6129714",
"0.6114891",
"0.61148006",
"0.61124206",
"0.60963553",
"0.6065894... | 0.84537125 | 0 |
Tests if a given package is included in the specified flavor | def package_in_flavor?(pkg, flavor_name)
flavor_def = flavor_by_name(flavor_name)
if pkg.respond_to?(:name)
pkg = pkg.name
end
if flavor_def.implicit?
pkg_set = Autoproj.manifest.find_package_definition(pkg).package_set
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def development_pkg?(pkg)\n if (r = development_regex) && pkg =~ r\n return true\n end\n\n false\n end",
"def has_flavor?(flavor_name)\n flavors.has_key?(flavor_name)\n end",
"def include?(pkg)\n pkg = pkg.name unless pkg.respond_to?(:to_str)\n p... | [
"0.67300725",
"0.6532205",
"0.6393685",
"0.63079906",
"0.629536",
"0.62749374",
"0.61166245",
"0.6097722",
"0.6093784",
"0.6061855",
"0.602316",
"0.60223246",
"0.6021556",
"0.6013751",
"0.5965969",
"0.59461343",
"0.5928526",
"0.5928036",
"0.59243786",
"0.5903638",
"0.5902715"... | 0.82467526 | 0 |
Declares that the package definitions created by the given block are part of the listed flavors | def in_flavor(*flavors, &block)
if flavors.last.kind_of?(Hash)
options = flavors.pop
options = Kernel.validate_options options, :strict => false
else
options = Hash.new
end
flavor = current_flavor
current_packa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_flavored_package_set(package_set)\n package_sets << package_set\n end",
"def only_in_flavor(*flavors, &block)\n if flavors.last.kind_of?(Hash)\n options = flavors.pop\n options, other_options = Kernel.filter_options options, :strict => true\... | [
"0.5921792",
"0.590084",
"0.5899898",
"0.58683646",
"0.58509797",
"0.57545674",
"0.5576287",
"0.5505862",
"0.54708034",
"0.54251176",
"0.5387594",
"0.5380727",
"0.53268415",
"0.52840537",
"0.5204422",
"0.51989317",
"0.51819724",
"0.51637536",
"0.5129875",
"0.51004094",
"0.506... | 0.7485267 | 0 |
Registers the given package set as being flavored | def register_flavored_package_set(package_set)
package_sets << package_set
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_package_set(pkg_set)\n invalidate_ignored_package_names\n metapackage(pkg_set.name)\n metapackage(\"#{pkg_set.name}.all\")\n @package_sets << pkg_set\n end",
"def package(*patterns)\n install_package_matching patterns\n end",
"def in_flavor(*f... | [
"0.74806404",
"0.5717852",
"0.567658",
"0.5661068",
"0.5642744",
"0.56174225",
"0.55924463",
"0.540081",
"0.52750415",
"0.5269136",
"0.52577025",
"0.5223495",
"0.5222323",
"0.52190226",
"0.51801276",
"0.51651037",
"0.51541144",
"0.5142587",
"0.50845444",
"0.50638837",
"0.5063... | 0.8666796 | 0 |
Declares that the package definitions created by the provided block should be registered only if the current flavor is one of the listed flavors | def only_in_flavor(*flavors, &block)
if flavors.last.kind_of?(Hash)
options = flavors.pop
options, other_options = Kernel.filter_options options, :strict => true
options = options.merge(other_options)
else
options = { :strict => tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_flavor(*flavors, &block)\n if flavors.last.kind_of?(Hash)\n options = flavors.pop\n options = Kernel.validate_options options, :strict => false\n else\n options = Hash.new\n end\n\n flavor = current_flavor\n\n ... | [
"0.741293",
"0.60586756",
"0.58299994",
"0.56690794",
"0.54966384",
"0.54772615",
"0.5408597",
"0.537171",
"0.53183556",
"0.53025615",
"0.5223443",
"0.52229196",
"0.51914275",
"0.51345336",
"0.51180476",
"0.50705856",
"0.5057148",
"0.50526047",
"0.5030427",
"0.5019342",
"0.49... | 0.61953515 | 1 |
Finalize the setup by applying the selected / removed packages to Autoproj's metapackages as well as by updating the current flavor's set of default packages (mainly if it is implicit) | def finalize
package_sets.each do |pkg_set|
meta = Autoproj.manifest.metapackages[pkg_set.name]
meta_package_names = meta.each_package.inject(Set.new) { |s, p| s << p.name }
if current_flavor.implicit?
in_a_flavor = flavors.values.inject(S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize_setup(\n packages = [],\n non_imported_packages: :ignore,\n recursive: true,\n auto_exclude: false,\n read_only: false\n )\n Autoproj.silent do\n packages, config_selected =\n ... | [
"0.71348006",
"0.65660626",
"0.614176",
"0.6133048",
"0.6077841",
"0.5996741",
"0.5925437",
"0.58330363",
"0.58330363",
"0.5818007",
"0.5800913",
"0.57719576",
"0.5724873",
"0.56828225",
"0.5601885",
"0.5596513",
"0.55873966",
"0.55873966",
"0.55293864",
"0.5475211",
"0.54698... | 0.7987752 | 0 |
Verifies that the package's branch is not a flavor that they are not included in (i.e. a package cannot be on the 'next' branch if it is not included in the 'next' flavor). Resets the branch of these packages to the given default branch | def reset_invalid_branches_to(default_branch = 'master')
switched_packages = Array.new
Autoproj.manifest.each_package_definition do |pkg_def|
pkg = pkg_def.autobuild
next if !pkg.importer.kind_of?(Autobuild::Git)
next if pkg.importer.branch == defa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_overriden_flavored_branches\n wrong_branch = Array.new\n Autoproj.manifest.each_package_definition do |pkg_def|\n pkg = pkg_def.autobuild\n next if !pkg.importer.kind_of?(Autobuild::Git)\n\n if package_in_flavor?(pkg, current_flavor.na... | [
"0.6290787",
"0.5919356",
"0.5866764",
"0.57136637",
"0.5665111",
"0.5665054",
"0.5567229",
"0.55548775",
"0.54760313",
"0.5439984",
"0.54358464",
"0.53409237",
"0.5305795",
"0.5302122",
"0.52763957",
"0.5210289",
"0.5192806",
"0.5063262",
"0.5048903",
"0.502627",
"0.5017966"... | 0.7938941 | 0 |
Finds all packages which should have been on a branch that is the flavor's branch, but are actually on a different one | def find_all_overriden_flavored_branches
wrong_branch = Array.new
Autoproj.manifest.each_package_definition do |pkg_def|
pkg = pkg_def.autobuild
next if !pkg.importer.kind_of?(Autobuild::Git)
if package_in_flavor?(pkg, current_flavor.name) &&
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_invalid_branches_to(default_branch = 'master')\n switched_packages = Array.new\n Autoproj.manifest.each_package_definition do |pkg_def|\n pkg = pkg_def.autobuild\n next if !pkg.importer.kind_of?(Autobuild::Git)\n next if pkg.importer.bran... | [
"0.6547932",
"0.65102905",
"0.62711203",
"0.6155635",
"0.6153265",
"0.5966594",
"0.5927354",
"0.5915977",
"0.58631223",
"0.5834466",
"0.580919",
"0.57913303",
"0.57530046",
"0.5722213",
"0.572059",
"0.56931406",
"0.5651165",
"0.5651165",
"0.56499845",
"0.56032413",
"0.5550238... | 0.78882253 | 0 |
Runs the test case. | def test_getAttributeNodeNS01
namespaceURI = "http://www.nist.gov";
localName = "invalidlocalname";
doc = nil
elementList = nil
testAddr = nil
attribute = nil
doc = load_document("staffNS", false)
elementList = doc.getElementsByTagName("emp:address")
testAddr = elementList.item(0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end",
"def run\n\n @startDate = Time.now.to_i * 1000\n @status... | [
"0.7799092",
"0.7670545",
"0.75712216",
"0.75627315",
"0.75226235",
"0.75201446",
"0.74722594",
"0.7330742",
"0.7330742",
"0.72492516",
"0.72388816",
"0.72313887",
"0.72023034",
"0.7136023",
"0.70817155",
"0.7047509",
"0.7020568",
"0.6938718",
"0.6918842",
"0.6867642",
"0.685... | 0.0 | -1 |
Gets URI that identifies the test. | def targetURI
"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/getAttributeNodeNS01"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getURI()\n return @uri.to_s\n end",
"def uri\n @uri.to_s\n end",
"def uri\n uri_for({}, nil)\n end",
"def uri\n return @uri\n end",
"def uri\n return @uri\n end",
"def uri\n @uri\n end",
"def uri\n @uri\n end"... | [
"0.7387945",
"0.7351851",
"0.71513367",
"0.7137951",
"0.7137951",
"0.7114108",
"0.7114108",
"0.7086164",
"0.70651335",
"0.6988005",
"0.6925742",
"0.6925742",
"0.69119173",
"0.69119173",
"0.6861145",
"0.68302125",
"0.68073744",
"0.67857945",
"0.6764499",
"0.6764499",
"0.675217... | 0.0 | -1 |
GET /closing_cashes GET /closing_cashes.json | def index
@closing_cashes = ClosingCash.all
@filterrific = initialize_filterrific(
ClosingCash,
params[:filterrific],select_options: {
sorted_by_cash: Cash.options_for_sorted_by_cash
},
persistence_id: false
) or return
@closing_cashes = @filterrific.find.page(params[:page]).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @closedcashes = Closedcash.all\n end",
"def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @cabines... | [
"0.6032498",
"0.55267465",
"0.54984665",
"0.5303178",
"0.52079666",
"0.5193628",
"0.51081717",
"0.5097492",
"0.50852746",
"0.5079768",
"0.5065298",
"0.50586873",
"0.50174934",
"0.50165874",
"0.5002984",
"0.4976437",
"0.49581522",
"0.49566585",
"0.49496785",
"0.49417073",
"0.4... | 0.0 | -1 |
GET /closing_cashes/1 GET /closing_cashes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @closedcashes = Closedcash.all\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url... | [
"0.6175126",
"0.5842883",
"0.56787205",
"0.55720365",
"0.55651027",
"0.556049",
"0.5505978",
"0.5464112",
"0.5462877",
"0.54432833",
"0.5335545",
"0.5326102",
"0.5310737",
"0.5291775",
"0.52610326",
"0.5256039",
"0.52529466",
"0.52442783",
"0.52365094",
"0.51816386",
"0.51505... | 0.0 | -1 |
POST /closing_cashes POST /closing_cashes.json | def create
@closing_cash = ClosingCash.new(closing_cash_params)
apertura = OpeningCash.find(@closing_cash.opening_cash.id)
empleado = Employee.find(apertura.employee.id)
caja = Cash.find(apertura.cash.id)
respond_to do |format|
if @closing_cash.save
apertura.estado = "finalizado"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closedcash.destroy\n respond_to do |format|\n format.ht... | [
"0.5758233",
"0.54235446",
"0.5207429",
"0.50779617",
"0.50616807",
"0.50500315",
"0.5030585",
"0.50231946",
"0.5009645",
"0.48907864",
"0.48900634",
"0.4865357",
"0.48590723",
"0.48169538",
"0.47929475",
"0.47893068",
"0.47770754",
"0.47756612",
"0.47704545",
"0.47693163",
"... | 0.4761929 | 20 |
PATCH/PUT /closing_cashes/1 PATCH/PUT /closing_cashes/1.json | def update
respond_to do |format|
if @closing_cash.update(closing_cash_params)
format.html { redirect_to @closing_cash, notice: 'Closing cash was successfully updated.' }
format.json { render :show, status: :ok, location: @closing_cash }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.e... | [
"0.5791621",
"0.5679818",
"0.56430894",
"0.564259",
"0.5598466",
"0.5573998",
"0.55676144",
"0.5567161",
"0.5551865",
"0.55395114",
"0.55326647",
"0.5525235",
"0.55076724",
"0.5505558",
"0.54969215",
"0.5486909",
"0.5475975",
"0.5472604",
"0.54661864",
"0.5463058",
"0.544614"... | 0.56453425 | 2 |
DELETE /closing_cashes/1 DELETE /closing_cashes/1.json | def destroy
@closing_cash.destroy
respond_to do |format|
format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca.destroy\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end... | [
"0.6812968",
"0.6734194",
"0.67341834",
"0.6733542",
"0.66651016",
"0.6639663",
"0.6616964",
"0.6570926",
"0.6546518",
"0.65318924",
"0.6527004",
"0.65185386",
"0.6518289",
"0.65015846",
"0.64981425",
"0.64889014",
"0.64782894",
"0.64695716",
"0.6456125",
"0.6451739",
"0.6446... | 0.6873363 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_closing_cash
@closing_cash = ClosingCash.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 closing_cash_params
params.require(:closing_cash).permit(:fecha_cierre, :monto_efectivo, :monto_cheque, :monto_tcredito, :monto_tdebito,:existente_efe,:existente_cheque,:existente_tcre,:existente_tdb,:opening_cash_id,:dif_registrada,:dif_efectivo,:dif_cheque,:dif_credito,:dif_debito)
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 |
Use callbacks to share common setup or constraints between actions. | def set_rating
@rating = Rating.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.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def rating_params
params.require(:rating).permit(:score, :game_id)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Returns a vgood, this method act as Vgood.getByUser but providing player guid instead of userExt. | def getVgoodByGuid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_player_with_user_id(user_id)\n go_fish.find_player_with_user_id(user_id)\n end",
"def find_player_by_user(user_id)\n if self.user_id == user_id\n # This is the mod\n return nil\n end\n last_registered_player_id = self.last_registered_player_id.to_i\n ... | [
"0.6528442",
"0.5737649",
"0.5511734",
"0.54944414",
"0.54468954",
"0.531479",
"0.531479",
"0.53005034",
"0.52059203",
"0.51760215",
"0.5115197",
"0.5112983",
"0.5112682",
"0.5106403",
"0.50685453",
"0.5057305",
"0.5018028",
"0.5012843",
"0.49948636",
"0.49879593",
"0.4984302... | 0.6359809 | 1 |
return the friends of the given user | def convert
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end",
"def friends(user=nil)\n\t\tcursor = -1\n\t\tpage = 0\n\t\tfriends = []\n\t\tbegin\n\t\t\tfriendspage = friends_by_cursor( user, cursor )\n\t\t\tpage += 1\n\t\t\tputs \"page #{page}/cursor #{cursor} - fo... | [
"0.83619845",
"0.82586104",
"0.79531586",
"0.78321713",
"0.78047395",
"0.7751407",
"0.76780605",
"0.75105137",
"0.7413652",
"0.74053913",
"0.7339756",
"0.7308411",
"0.73055464",
"0.7283435",
"0.7183846",
"0.7180711",
"0.7155487",
"0.714527",
"0.7139784",
"0.71260923",
"0.7066... | 0.0 | -1 |
return the friends of the given user | def sendAsGift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(user_id=self.username)\n connection.get(\"/users/#{user_id}/friends\").body.users\n end",
"def friends(user=nil)\n\t\tcursor = -1\n\t\tpage = 0\n\t\tfriends = []\n\t\tbegin\n\t\t\tfriendspage = friends_by_cursor( user, cursor )\n\t\t\tpage += 1\n\t\t\tputs \"page #{page}/cursor #{cursor} - fo... | [
"0.8362216",
"0.8258623",
"0.7952678",
"0.7831647",
"0.7805172",
"0.7750808",
"0.7677932",
"0.7510322",
"0.74128425",
"0.74051934",
"0.7339625",
"0.73089916",
"0.73056877",
"0.72833705",
"0.7184169",
"0.7180228",
"0.71552217",
"0.7145164",
"0.713905",
"0.71251094",
"0.7065932... | 0.0 | -1 |
this is hit when users go to '/s/J31js' or some other shortcode this finds what campaign the shortcode corresponds to and redirects to that campaign's page it also creates a cookie so that referrer can get credited for referring someone to the page | def key_redirect
share_link = Sharelink.find_by_short_key!(params[:short_code])
cookies.signed[:referrer_id] = {
:value => share_link.referrer_id,
:expires => 1.day.from_now,
}
redirect_to campaign_path(share_link.campaign)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referrer\n if params[:code]\n wechat_api_connect_solver = WechatApi::ConnectSolver.new(params[:code]).resolve\n\n # this is taken from application controller\n if wechat_api_connect_solver.success?\n user = wechat_api_connect_solver.data[:customer]\n\n # we turn him into a real ... | [
"0.6252538",
"0.6150484",
"0.604409",
"0.58607256",
"0.57524985",
"0.5689966",
"0.56813323",
"0.56504697",
"0.561467",
"0.56131023",
"0.55931187",
"0.5582443",
"0.5581802",
"0.5576928",
"0.5551349",
"0.55439526",
"0.55191",
"0.55140376",
"0.5502",
"0.5499775",
"0.5475633",
... | 0.74570775 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.