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
Return new line translated so p1 is at particular location
def translate_to_point(*location) p = Point.new(*location) Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_to_line\n end", "def from_line\n position.new_line\n end", "def line_for_position(position); end", "def line_for_position(position); end", "def line_for_position(position); end", "def maatsf_paragraph_new_line(orig_method, text, pos, *args, &block)\n tw = nil\n tw = maatsf_set_ne...
[ "0.63746226", "0.6356495", "0.62460226", "0.62460226", "0.62460226", "0.61923873", "0.61369", "0.61369", "0.6113385", "0.6078563", "0.60681546", "0.6044182", "0.5943324", "0.58833987", "0.5865669", "0.5749338", "0.57304543", "0.56884164", "0.5609299", "0.56025183", "0.5586850...
0.63550085
2
Return new line rotated counterclockwise by angle in radians
def rotate(angle) x = x2 - x1 y = y2 - y1 cos_angle = Math.cos(angle) sin_angle = Math.sin(angle) new_x = (x * cos_angle) - (y * sin_angle) new_y = (x * sin_angle) - (y * cos_angle) Line.new(p1, Point.new(x1 + new_x, y1 + new_y)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end", "def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end", "def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end", "def draw_ro...
[ "0.6718585", "0.64857376", "0.6479498", "0.6270348", "0.62383956", "0.6219711", "0.62067306", "0.61605257", "0.6139731", "0.6075108", "0.60303277", "0.6019485", "0.5973809", "0.5943368", "0.5933088", "0.59028244", "0.58996296", "0.5859612", "0.58103454", "0.5793436", "0.57442...
0.71338814
0
Return Point which is midpoint of this line
def midpoint Point.new((x1 + x2) / 2, (y1 + y2) / 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midpoint\n\t\t(@startrange+@endrange)/2\n\tend", "def midpoint(point)\n la, lo = Ubiquity::Geoformulas.midpoint self.lat, self.lon, point.lat, point.lon\n self.class.new la, lo\n end", "def get_midpoint(point)\n Point.new(*to_a.zip(point.to_a).map { |a, b| (a + b) / 2.0 })\n end", "def m...
[ "0.77143437", "0.7288287", "0.7249693", "0.7239796", "0.72290844", "0.6939305", "0.68765694", "0.6728497", "0.640997", "0.6383611", "0.6335571", "0.61800426", "0.61688066", "0.6146906", "0.609811", "0.5951315", "0.59446114", "0.5940135", "0.59255594", "0.58947635", "0.5848605...
0.8258778
0
Show (x1, y1) > (x2, y2)
def to_s "#{p1} \u{2192} #{p2}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_coords(x1, _y1, x2, _y2)\n return x1 > x2\n end", "def compare_coords(_x1, y1, _x2, y2)\n return y1 > y2\n end", "def compare(x, y); end", "def <=>(other)\nreturn nil unless other.instance_of? Point\n@x**2 + @y**2 <=> other.x**2 + other.y**2\nend", "def xTile(x,y)\r\n ...
[ "0.7407181", "0.73431456", "0.6489177", "0.62816507", "0.62716115", "0.6262903", "0.6240235", "0.6188924", "0.61402804", "0.6138633", "0.6120508", "0.6120248", "0.6108368", "0.60983616", "0.6097517", "0.6097517", "0.6097517", "0.6094554", "0.6076542", "0.6071458", "0.6063172"...
0.0
-1
Intialize Point from Point, array of two numbers, or two numbers
def initialize(*args) if args.size == 1 arg = args.first if arg.is_a?(Point) @x, @y = arg.x, arg.y elsif arg.is_a?(Array) && arg.size == 2 @x, @y = arg[0, 2] end elsif args.size == 2 @x, @y = args[0, 2] end unless @x && @y && @x.numeric? && @y.numeric? raise 'arguments must be two numbers, or an array of two numbers' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_point\n if length == 2\n p = Point.new(*self)\n elsif length == 1\n p = self[0].clone\n end\n return p\n end", "def new_point(p)\n case p\n when :infinity\n infinity\n when Array\n x, y = p\n Point.new(self, x, y)\n when Integer\n gene...
[ "0.72388905", "0.71468437", "0.6781029", "0.6781029", "0.62851137", "0.62496936", "0.6242274", "0.617548", "0.6074473", "0.60581523", "0.6015989", "0.59970766", "0.5873789", "0.581857", "0.5807416", "0.58063763", "0.5762147", "0.57534844", "0.5745418", "0.57445043", "0.572526...
0.69648975
2
Return new point translated by (x, y) offset
def translate(*offset) p = Point.new(*offset) self + p end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_to_point(*location)\n p = Point.new(*location)\n Line.new(p, Point.new(p.x + (x2 - x1), p.y + (y2 - y1)))\n end", "def move_to(point)\n offset(point.x - @left, point.y - @top)\n end", "def offset(x, y)\n @left += x\n @top += y\n @right += x\n @bottom += y\n end", "def tr...
[ "0.71971124", "0.68405414", "0.6827619", "0.6728835", "0.6698928", "0.6508562", "0.64552987", "0.6436624", "0.64237845", "0.6412617", "0.64023244", "0.63530976", "0.63200027", "0.6302212", "0.62785023", "0.62785023", "0.6269654", "0.6258183", "0.62494236", "0.62429404", "0.62...
0.79354286
0
damage is an array first el: number of rolls, second el: which dice.
def initialize(name, type, ac, attack_bonus, hp, damage) @name=name @type=type @ac=ac @attack_bonus=attack_bonus @hp=hp @damage=damage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gets_damage(damage)\n damage = damage.to_i\n @life_points = @life_points - damage\n if @life_points <= 0\n @life_points = 0\n puts \"le joueur #{names} a été tué\"\n end\n end", "def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end", "def tak...
[ "0.71712977", "0.71241724", "0.7046867", "0.7022833", "0.6981619", "0.6889251", "0.688468", "0.684516", "0.6790225", "0.67876", "0.6749337", "0.6739037", "0.6730519", "0.66871095", "0.6646631", "0.66249144", "0.66161615", "0.6582354", "0.65539056", "0.65379095", "0.65379095",...
0.0
-1
lookup the user who liked the video and update the denormalized user data stored on this document
def refresh_user_data! if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id) self.name = user.name self.nickname = user.nickname self.user_image = user.user_image self.user_image_original = user.user_image_original self.has_shelby_avatar = user.has_shelby_avatar end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_post_like\n @user_post_like = UserPostLike.find(params[:id])\n end", "def rate_movie(movie, liked)\n movie_id = movie.id\n liked = case liked.downcase\n when 'yes', 'true', '1' then true\n when 'no', 'false', '0' then false\n else nil\n end if liked.resp...
[ "0.59608316", "0.5840781", "0.58404464", "0.57940245", "0.57874954", "0.57581806", "0.57268405", "0.570517", "0.56988174", "0.5686855", "0.56706774", "0.5644251", "0.562924", "0.5623418", "0.55871737", "0.5585182", "0.5529666", "0.5491607", "0.5462438", "0.54497856", "0.54163...
0.0
-1
Renders the header for the format. This should be implemented by the implementing format.
def header_render fail ProcessorNotImplementedError, "Please implement #{self.class}#header_render" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render\n renderer.render_header self\n end", "def header\n end", "def Header()\n\t\tif (@print_header)\n\t\t\tif (@original_l_margin.nil?)\n\t\t\t\t@original_l_margin = @l_margin;\n\t\t\tend\n\t\t\tif (@original_r_margin.nil?)\n\t\t\t\t@original_r_margin = @r_margin;\n\t\t\tend\n\t\t\t\n\t\t\t#s...
[ "0.8147307", "0.73298323", "0.730108", "0.72145635", "0.7197888", "0.7112571", "0.7026753", "0.6988317", "0.6988317", "0.6988317", "0.69632", "0.6915743", "0.6878485", "0.6851385", "0.68251616", "0.68124163", "0.6790988", "0.678903", "0.6781453", "0.6730255", "0.6718363", "...
0.7229761
3
The header level. This is an integer between 1 and 6.
def header_level @pairs.fetch("level", "1").to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_level\n if self.type != :header\n raise NodeError, \"can't get header_level for non-header\"\n end\n CMark.node_get_header_level(@pointer)\n end", "def output_header_level(level); end", "def header_level=(level)\n if self.type != :header\n raise NodeError, \"can'...
[ "0.8043197", "0.7818882", "0.75351423", "0.73642606", "0.68895334", "0.67351747", "0.6688271", "0.66327614", "0.6437325", "0.64063877", "0.63886285", "0.63886285", "0.63349885", "0.62465453", "0.6219218", "0.6210601", "0.6210601", "0.6210601", "0.6210601", "0.6210601", "0.621...
0.85691166
0
The "value" of the header. This is the contents or the name of the header. This is required.
def header_value @pairs.fetch("value") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_value\n return @header_value\n end", "def value\n @header.input.value.to_s.strip\n end", "def header_value=(value)\n @header_value = value\n end", "def header(value = nil)\n value ? self.header = value : @header\n end", "def header\...
[ "0.855174", "0.81833327", "0.7936473", "0.7541781", "0.71091247", "0.7088129", "0.7076948", "0.6996769", "0.69835174", "0.6940293", "0.69207835", "0.6877441", "0.6861424", "0.68439496", "0.67596555", "0.674959", "0.6730609", "0.6670904", "0.6661318", "0.6640006", "0.663359", ...
0.8251087
1
The "id" of the header. This should be a unique value between all headers that specifies this exact header.
def header_id @pairs.fetch("id") { header_value.downcase.gsub(/[^\w]|_/, "-") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_id(n)\n \"#{n.dom_id}_header\"\n end", "def id_to_header(id)\n id.to_s(16)\n end", "def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit ...
[ "0.78558457", "0.7233707", "0.7214907", "0.71444905", "0.706894", "0.70490414", "0.6949962", "0.69280016", "0.6878453", "0.67876214", "0.6762453", "0.665795", "0.6592744", "0.65576386", "0.65220034", "0.6497393", "0.647482", "0.6451103", "0.6443489", "0.64403313", "0.6409418"...
0.83244723
0
converts celsius to fahrenheit
def ctof(celsius) celsius * 1.8 + 32 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend", "def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend", "def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend", "def fahrenheit_to_celsius(fahrenheit)\n celsius = ((fahrenhei...
[ "0.852547", "0.85019875", "0.8454041", "0.8410084", "0.8402705", "0.8388333", "0.83769643", "0.8248032", "0.82164055", "0.82006013", "0.8200105", "0.81951", "0.8168281", "0.8159734", "0.81536275", "0.8133234", "0.81093156", "0.8103944", "0.8094869", "0.8067988", "0.80497104",...
0.7081994
75
GET /searches GET /searches.json
def index @searches = Search.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.7737936", "0.7604427", "0.75483096", "0.71530956", "0.7150144", "0.7135791", "0.70674586", "0.70497304", "0.69962347", "0.6986162", "0.6971139", "0.6954953", "0.6952561", "0.68742293", "0.68722004", "0.67970055", "0.6766185", "0.6732622", "0.67076194", "0.6700543", "0.6691...
0.69155294
17
GET /searches/1 GET /searches/1.json
def show @regions = Region.search(@search.keywords) @states = State.search(@search.keywords) @areas = Area.search(@search.keywords) @territories = Territory.search(@search.keywords) @crags = Crag.search(@search.keywords) @walls = Wall.search(@search.keywords) @sport_routes = SportRoute.search(@search.keywords) @traditional_routes = TraditionalRoute.search(@search.keywords) @boulder_routes = BoulderRoute.search(@search.keywords) @sport_route_photos = SportRoutePhoto.search(@search.keywords) @traditional_route_photos = TraditionalRoutePhoto.search(@search.keywords) @boulder_route_photos = BoulderRoutePhoto.search(@search.keywords) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js...
[ "0.75890523", "0.7334231", "0.72093153", "0.6881175", "0.6876399", "0.68220216", "0.6811118", "0.679834", "0.6723004", "0.6711217", "0.6615113", "0.66145045", "0.6614429", "0.66067135", "0.660033", "0.65943927", "0.65943927", "0.65943927", "0.65943927", "0.65943927", "0.65873...
0.0
-1
POST /searches POST /searches.json
def create @search = Search.new(search_params) respond_to do |format| if @search.save format.html { redirect_to @search, notice: 'Search was successfully created.' } format.json { render :show, status: :created, location: @search } else format.html { render :new } format.json { render json: @search.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to action: 'new', query: @search.query }\n format.json { render ...
[ "0.7085371", "0.6885681", "0.67111516", "0.66765517", "0.6669165", "0.6652379", "0.6586092", "0.65569127", "0.65569127", "0.65569127", "0.65569127", "0.6538546", "0.6513982", "0.64972854", "0.64972854", "0.64972854", "0.6460953", "0.64186597", "0.6390358", "0.6381837", "0.635...
0.65514076
14
PATCH/PUT /searches/1 PATCH/PUT /searches/1.json
def update respond_to do |format| if @search.update(search_params) format.html { redirect_to @search, notice: 'Search was successfully updated.' } format.json { render :show, status: :ok, location: @search } else format.html { render :edit } format.json { render json: @search.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: 'edit' }\n format.json { render js...
[ "0.6522506", "0.6440078", "0.6440078", "0.6440078", "0.6440078", "0.6435268", "0.64060783", "0.63933635", "0.63933635", "0.63933635", "0.6303145", "0.6300157", "0.626477", "0.6252451", "0.62034214", "0.6158987", "0.61369526", "0.61277574", "0.6111257", "0.609092", "0.60736907...
0.6197208
20
DELETE /searches/1 DELETE /searches/1.json
def destroy @search.destroy respond_to do |format| format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_conten...
[ "0.75805426", "0.75805426", "0.75805426", "0.75805426", "0.75805426", "0.7468816", "0.7426114", "0.7426114", "0.7426114", "0.7426114", "0.74098223", "0.7379007", "0.7360586", "0.7341712", "0.73299676", "0.72784644", "0.72720206", "0.717556", "0.71688104", "0.71021444", "0.707...
0.724087
22
Use callbacks to share common setup or constraints between actions.
def set_search @search = Search.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 search_params params.require(:search).permit(:keywords) 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
Step1: Find `ServerAttributes.swift` file inside BreatheMapper project folder.
def find_server_attributes_swift_file project_folder_path = ARGV[0] project_folder_path = project_folder_path.strip.gsub('\\','') FastlaneCore::UI.important "🔍 Searching ServerAttributes.swift file inside folder: #{project_folder_path}." @server_attributes_file_path = Dir["#{project_folder_path}**/**/ServerAttributes.swift"][0] FastlaneCore::UI.important "👊 Found ServerAttributes.swift file at path: #{@server_attributes_file_path}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_server_attributes_in_swift_file\n url = ARGV[1]\n hmac_key = ARGV[2]\n swift_file_content = File.read(@server_attributes_file_path)\n swift_file_content = swift_file_content.gsub(/.*basePath.*/, \"\\topen static var basePath = \\\"#{url}\\\"\")\n swift_file_content = swift_file_content.gs...
[ "0.57924795", "0.51980644", "0.5172078", "0.5118558", "0.5060624", "0.5026113", "0.49847543", "0.49292758", "0.48889852", "0.4887022", "0.48754755", "0.48650298", "0.48353374", "0.48035434", "0.4776433", "0.47741213", "0.47604498", "0.47309256", "0.4724554", "0.4724264", "0.4...
0.79035157
0
Step2: Update `ServerAttributes.swift` file with input URL & HMAC_KEY.
def update_server_attributes_in_swift_file url = ARGV[1] hmac_key = ARGV[2] swift_file_content = File.read(@server_attributes_file_path) swift_file_content = swift_file_content.gsub(/.*basePath.*/, "\topen static var basePath = \"#{url}\"") swift_file_content = swift_file_content.gsub(/.*hmacKey.*/, "\topen static var hmacKey = \"#{hmac_key}\"") #Write changes to the ServerAttributes.swift` file. File.open(@server_attributes_file_path, "w") do |file| file.puts swift_file_content end FastlaneCore::UI.success "✅ Injected Url & Hmac-Key in ServerAttributes.swift at path: #{@server_attributes_file_path}\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hmac_server; end", "def update!(**args)\n @token_hmac_sha1_prefix = args[:token_hmac_sha1_prefix] if args.key?(:token_hmac_sha1_prefix)\n end", "def update!(**args)\n @token_hmac_sha1_prefix = args[:token_hmac_sha1_prefix] if args.key?(:token_hmac_sha1_prefix)\n end", "def...
[ "0.6179919", "0.6080079", "0.6080079", "0.54051095", "0.5354997", "0.5308186", "0.5286431", "0.52688676", "0.52036417", "0.51767975", "0.5174105", "0.5155628", "0.51543015", "0.51289445", "0.50898945", "0.5074222", "0.50636023", "0.5057468", "0.5051635", "0.5031183", "0.50311...
0.81581026
0
initialisation du plateau de jeu
def initialize @A1 = BoardCells.new("A1", " ") # parametre de boardcells @A2 = BoardCells.new("A2", " ") @A3 = BoardCells.new("A3", " ") @B1 = BoardCells.new("B1", " ") @B2 = BoardCells.new("B2", " ") @B3 = BoardCells.new("B3", " ") @C1 = BoardCells.new("C1", " ") @C2 = BoardCells.new("C2", " ") @C3 = BoardCells.new("C3", " ") @array_cells = [@A1, @A2, @A3, @B1, @B2, @B3, @C1, @C2, @C3] @winning_game = false @equality_game = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( plateau_de_jeu , name)\n @plateau= plateau_de_jeu\n @pion = @@numero_pion\n @nom = name\n @@numero_pion += 1\n end", "def initialize()\n @mano = $sin_jugada\n end", "def initialize(mano)\n\t\t@jugada = mano\n\tend", "def initialize(jugada_realizada)\n if $jugada...
[ "0.75505316", "0.7423968", "0.7348", "0.7076764", "0.67325276", "0.66825897", "0.6680546", "0.666761", "0.6594671", "0.65217054", "0.65116185", "0.65043104", "0.64500076", "0.64206785", "0.6407992", "0.64001554", "0.6392502", "0.6365096", "0.6364324", "0.63492966", "0.6335979...
0.0
-1
qui gagne ou match nul
def who_win? count_turn = 0 while count_turn <= 0 if @A1.content == "O" && @A2.content == "O" && @A3.content == "O" && @A1.content == "X" && @A2.content == "X" && @A3.content == "X" @winning_game = true end if @B1.content == "O" && @B2.content == "O" && @B3.content == "O" && @B1.content == "X" && @B2.content == "X" && @B3.content == "X" @winning_game = true end if @C1.content == "O" && @C2.content == "O" && @C3.content == "O" && @C1.content == "X" && @C2.content == "X" && @C3.content == "X" @winning_game = true end if @A1.content == "O" && @B1.content == "O" && @C1.content == "O" && @A1.content == "X" && @B1.content == "X" && @C1.content == "X" @winning_game = true end if @A2.content == "O" && @B2.content == "O" && @C2.content == "O" && @A2.content == "X" && @B2.content == "X" && @C2.content == "X" @winning_game = true end if @A3.content == "O" && @B3.content == "O" && @C3.content == "O" && @A3.content == "X" && @B3.content == "X" && @C3.content == "X" @winning_game = true end if @A1.content == "O" && @B2.content == "O" && @C3.content == "O" && @A1.content == "X" && @B2.content == "X" && @C3.content == "X" @winning_game = true end if @A3.content == "O" && @B2.content == "O" && @C1.content == "O" && @A3.content == "X" && @B2.content == "X" && @C1.content == "X" @winning_game = true end count_turn += 1 end if count_turn == 9 equality_game = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end", "def not_a_match(no)\n if no == false\n @e += 1 \n else nil \n end\n end", "def test_srch_back_for_nonexist_pattern\n @buffer = Buffer.new 'Now is the time for all good men to come to the aid o...
[ "0.6330372", "0.6308256", "0.61219764", "0.60608363", "0.6048482", "0.60259193", "0.60259193", "0.57660675", "0.57483876", "0.570681", "0.5700988", "0.5610557", "0.5606557", "0.55818975", "0.5569115", "0.5569115", "0.5565594", "0.5565594", "0.5519597", "0.5519597", "0.5498372...
0.0
-1
Creation d'un plateau de jeu
def show_board puts " 1 2 3" puts " a #{@A1.content} | #{@A2.content} | #{@A3.content}" puts " ---------" puts " b #{@B1.content} | #{@B2.content} | #{@B3.content}" puts " ---------" puts " c #{@C1.content} | #{@C2.content} | #{@C3.content}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( plateau_de_jeu , name)\n @plateau= plateau_de_jeu\n @pion = @@numero_pion\n @nom = name\n @@numero_pion += 1\n end", "def sauvegarderJeu()\n\t\t# création de la sauvegarde\n\t\t@sauvegarde = Sauvegarde.creer( self.joueur,self.carte,self.nbTour )\n\n @sauvegardeYaml = SauvegardeYA...
[ "0.723709", "0.71838975", "0.65433896", "0.6436418", "0.63068485", "0.6293102", "0.62009656", "0.61574596", "0.6133967", "0.61001176", "0.60417455", "0.6038026", "0.6021103", "0.5958929", "0.59143895", "0.59103423", "0.586705", "0.5855504", "0.58319247", "0.5821158", "0.58112...
0.0
-1
Returns the Pad with the given id (presumed to already exist). Use this instead of Instancepad when you know the Pad already exists; it will save an HTTP request.
def get_pad(id, options={}) Pad.new instance, id, options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad\n if pad_id\n @pad ||= Pad.new(instance, pad_id)\n else\n nil\n end\n end", "def create_pad(id, options={})\n Pad.create instance, id, options\n end", "def set_pad\n @pad = @current_user.pads.find(params[:id])\n end", "def find_by_padma_id(id)\n Co...
[ "0.76840734", "0.6725237", "0.6193982", "0.60296214", "0.59371525", "0.58871806", "0.58563244", "0.5854869", "0.56691635", "0.5613735", "0.5499298", "0.5492379", "0.54891485", "0.5475679", "0.5473537", "0.5473537", "0.54646224", "0.545089", "0.54452866", "0.542604", "0.541368...
0.8046466
0
Creates and returns a Pad with the given id. Options: text => 'initial Pad text'
def create_pad(id, options={}) Pad.create instance, id, options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createPad(padID, text=nil)\n params = {:padID => padID}\n params[:text] = text unless text.nil?\n call :createPad, params\n end", "def get_pad(id, options={})\n Pad.new instance, id, options\n end", "def createGroupPad(groupID, padName, text=nil)\n params = {:groupID => group...
[ "0.83212376", "0.7982806", "0.68996555", "0.6767895", "0.5898505", "0.5884055", "0.58471763", "0.5707477", "0.5672312", "0.56470275", "0.54785687", "0.534958", "0.5247609", "0.5221769", "0.5119767", "0.49914134", "0.49882478", "0.49842435", "0.4893729", "0.4888169", "0.488465...
0.8352786
0
12 hour flush throttle
def allowed_to_ship_data? return false if (Time.now.to_i - self.synced_at) < 43200 return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throttle; end", "def periodic_flush\n true\n end", "def throttles; end", "def throttle(wait, onLast, onFirst, interval, timestamps)\n \nend", "def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end", "def throttled_response; end", ...
[ "0.6923318", "0.6750685", "0.672676", "0.6639154", "0.65252763", "0.65026534", "0.63020855", "0.6267224", "0.62269866", "0.6213939", "0.6141712", "0.61169463", "0.60853726", "0.60718083", "0.59735864", "0.59711146", "0.58526903", "0.58322716", "0.5775919", "0.5755172", "0.570...
0.0
-1
Takes a list of lists of people, and return the oldest person in any of them.
def oldest_person_in_the_world(peoples) eldests = peoples.map do |people| oldest_person(people) end return oldest_person(eldests) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oldest_person(people)\nend", "def oldest_person(people)\n people.max do |person1, person2|\n person1[\"age\"] - person2[\"age\"]\n end\nend", "def name_of_oldest_person(people)\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller <<...
[ "0.69366086", "0.67374146", "0.6489216", "0.6363404", "0.63337535", "0.6166945", "0.6098138", "0.60744166", "0.60260075", "0.6013378", "0.59847355", "0.59511095", "0.592978", "0.5850767", "0.58098024", "0.58056855", "0.57045937", "0.5702514", "0.5697969", "0.564902", "0.56350...
0.73461175
0
How do you know that your code works? You test it! This function returns true if oldest_person() is correct, and false if it has a bug.
def test_oldest_person fred = make_person("Fred", "Smith", 44) susan = make_person("Susan", "Smith", 47) james = make_person("James", "Smith", 4) eldest = oldest_person([fred, susan, james]) return eldest["first_name"] == "Susan" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oldest_person(people)\nend", "def youngest_person(people)\n # ??? <-- Only do this after writing the test and making sure it starts out failing!\nend", "def oldest?\n self.tll_prev.nil?\n end", "def oldest_person(people)\n people.max do |person1, person2|\n person1[\"age\"] - person2...
[ "0.70084155", "0.63340235", "0.6250056", "0.62187105", "0.61395764", "0.6086143", "0.6035056", "0.60241723", "0.59682643", "0.5959735", "0.59519005", "0.59193265", "0.5833024", "0.5823678", "0.5753683", "0.5730108", "0.5679426", "0.56787264", "0.5667216", "0.56594986", "0.560...
0.73306483
0
> test_oldest_person() => true Try introducing a bug into oldest_person(), and check that test_oldest_person() starts to return false. > test_oldest_person() => false Challenge: write a function that returns true if oldest_person_in_the_world() works correctly.
def test_oldest_person_in_the_world # ??? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_oldest_person\n fred = make_person(\"Fred\", \"Smith\", 44)\n susan = make_person(\"Susan\", \"Smith\", 47)\n james = make_person(\"James\", \"Smith\", 4)\n\n eldest = oldest_person([fred, susan, james])\n\n return eldest[\"first_name\"] == \"Susan\"\nend", "def youngest_person(people)\n # ??? <--...
[ "0.76076955", "0.69125533", "0.667825", "0.6454307", "0.623117", "0.57865477", "0.56686854", "0.5640275", "0.5621734", "0.5609378", "0.5607189", "0.55984133", "0.5579363", "0.5561324", "0.55260843", "0.5521449", "0.54984665", "0.54864305", "0.5473337", "0.5422871", "0.5414753...
0.75161576
1
Challenge: write a function that returns true if youngest_person() works correctly. Then, write youngest_person() and check that it's correct using your test.
def youngest_person # ??? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def youngest_person(people)\n # ??? <-- Only do this after writing the test and making sure it starts out failing!\nend", "def test_oldest_person\n fred = make_person(\"Fred\", \"Smith\", 44)\n susan = make_person(\"Susan\", \"Smith\", 47)\n james = make_person(\"James\", \"Smith\", 4)\n\n eldest = oldest_p...
[ "0.80800766", "0.65589494", "0.6278496", "0.6243282", "0.61059743", "0.60725385", "0.60108936", "0.5983582", "0.59155715", "0.5896196", "0.5889628", "0.5889628", "0.5791695", "0.57796335", "0.57783604", "0.5766662", "0.5762439", "0.57607263", "0.5682667", "0.56697214", "0.564...
0.74623716
1
Challenge: write a function that returns true if youngest_person() works correctly. Then, write youngest_person() and check that it's correct using your test. youngest_person() should take an Array of people and return the youngest one. Hint: Consider using max or min, which are defined on the ruby docs site.
def youngest_person(people) # ??? <-- Only do this after writing the test and making sure it starts out failing! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def youngest_person\n # ???\nend", "def getMostAwesomePerson\n return @persons.max\n end", "def youngest_person_retirement_age\n self.persons.min_by { |p| p[:age] }[:retirement_age]\n end", "def oldest_person(people)\n people.max do |person1, person2|\n person1[\"age\"] - person2[\"age\"]\n end...
[ "0.7435664", "0.69674474", "0.6668061", "0.6545905", "0.6291719", "0.62431866", "0.6224673", "0.6159051", "0.6134764", "0.6102776", "0.6101716", "0.60863775", "0.6031127", "0.6017547", "0.5996277", "0.59942704", "0.5974075", "0.59650546", "0.5964987", "0.5958745", "0.5942813"...
0.7258673
1
Convert keys which including '' to '_' because it might be common pitfall. Remove invalid chars.
def normalize_key(k) k.to_s.gsub('-', '_').gsub(INVALID_PATTERN, '').to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_key key\n key.gsub! '-', '_'\n key.gsub! ' ', ''\n key.gsub! ',', ''\n key.downcase!\n return key\n end", "def normalize_key(key)\n case key\n when Numeric, nil\n # nils never happen here in Ruby >= 2.3 since nils\n # skip the normalizer.\n...
[ "0.7746623", "0.75892967", "0.7413534", "0.7325731", "0.7307294", "0.71740425", "0.7071234", "0.70522904", "0.7004681", "0.7004681", "0.694285", "0.6931507", "0.6881457", "0.6874349", "0.68700826", "0.68673193", "0.6852348", "0.6836746", "0.680604", "0.6753872", "0.669508", ...
0.7654844
1
if the boolean is true it returns false if the boolean is false it returns true if the boolean is anything other than a boolean it returns a string
def reverse(bool) if bool == true return false end if bool == false return true end if (bool != true || bool != false) return "boolean expected" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean_to_string(b)\n if b \n \"true\"\n else\n \"false\"\n end\nend", "def boolean_to_string(b)\n if true\n \"true\"\n else\n \"false\"\n end\nend", "def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anythin...
[ "0.84887356", "0.8389205", "0.813926", "0.805895", "0.7640366", "0.7580215", "0.7497714", "0.7461598", "0.7412965", "0.73827446", "0.7378105", "0.7341924", "0.7320718", "0.7296955", "0.72760326", "0.7270971", "0.7258339", "0.7246895", "0.7245857", "0.72113067", "0.72032994", ...
0.6782662
69
this might ultimately want to be in spec helper... generate an array of arrays of valid data, as per spec, to pass to Purchase.parse_data. this kind of thing is a great application for QuickCheck ( for which there is a ruby equivalent: ( but considering that beyond the scope of this project.
def generate_test_data headerrow = ['foo', 'bar', 'baz', 'qux', 'quy', 'quz'] # contents inconsequential merchant_name = "foo bar" # use for occassional repetition item_description = "baz qux" item_price = 100 # proc to generate a row of data with occassional repetition as per values above rowgen = Proc.new { [Faker::Name.name, [Faker::Commerce.product_name, item_description].sample, [Faker::Number.number(3), item_price].sample, (1..100).to_a.sample, Faker::Address.street_address, [Faker::Company.name, merchant_name].sample] } data = [ headerrow ] (0..(rand(100)+20)).each{ data << rowgen.call } # generate random number of rows data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_data() [] end", "def build_data_array\n table = helper_class.new(@file_upload.file.path).to_table # # load data to array of hashes\n errors = []\n data = table.map do |item_hash|\n process_item(attributes(item_hash), errors)\n end\n [data, errors]\n end", "def get_validate dat...
[ "0.6551316", "0.6527119", "0.6295422", "0.6072309", "0.59033036", "0.58047545", "0.57851", "0.56993425", "0.5683679", "0.5562651", "0.55615175", "0.55565894", "0.5545833", "0.55381346", "0.55319583", "0.5525062", "0.55076325", "0.5471955", "0.5468248", "0.546475", "0.5416219"...
0.0
-1
task ::::: write cube method that accepts array and returns new array of values cubed.
def cubes(arr) p cubies = arr.map {|n| n ** 3} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cubed_values (array)\n\n cubed_array = array.map { | number | number ** 3 }\n return cubed_array\n\nend", "def cubes(array)\n array.map { |number| number ** 3}\n # Return array\nend", "def cubes(array)\narray.map {|number| number ** 3}\n\n\nend", "def cubes(array)\n array.map { |number| number ** 3 ...
[ "0.6885748", "0.68004954", "0.6520313", "0.64706933", "0.63732916", "0.6084757", "0.5871671", "0.5784432", "0.5783873", "0.5747733", "0.57374686", "0.57374686", "0.56722575", "0.56513137", "0.56513137", "0.55768555", "0.5541383", "0.55248517", "0.5521258", "0.55207586", "0.54...
0.6504682
3
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new return invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833", "0.717024...
0.0
-1
Check to see if the all the properties in the model are valid
def valid? return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :...
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.6618...
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && schedule_id == o.schedule_id && retention_period == o.retention_period && schedule_interval_type == o.schedule_interval_type && repeat_interval == o.repeat_interval && start_date == o.start_date && start_time == o.start_time && end_time == o.end_time && days_of_week == o.days_of_week && day_of_month == o.day_of_month && weekday_of_month == o.weekday_of_month end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en...
[ "0.72932124", "0.7189842", "0.70406866", "0.7007727", "0.68881786", "0.68621296", "0.67085785", "0.66622394", "0.661674", "0.6586541", "0.65844727", "0.65818226", "0.65561724", "0.6545535", "0.6508076", "0.64813215", "0.64577025", "0.64179385", "0.6414028", "0.6414028", "0.64...
0.0
-1
Calculates hash code according to all attributes.
def hash [schedule_id, retention_period, schedule_interval_type, repeat_interval, start_date, start_time, end_time, days_of_week, day_of_month, weekday_of_month].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ...
[ "0.7120876", "0.7039781", "0.7039781", "0.7039781", "0.7039781", "0.7039781", "0.7039781", "0.7039781", "0.68948233", "0.67841566", "0.6706898", "0.66992533", "0.6688269", "0.6669114", "0.6488987", "0.64612424", "0.64612424", "0.6444354", "0.6411414", "0.6396147", "0.6388743"...
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ...
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.666...
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = IFClient.const_get(type).new temp_model.build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s...
[ "0.7330926", "0.7274019", "0.7245751", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.7218884", ...
0.72504056
2
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "de...
[ "0.9010481", "0.8950689", "0.84703803", "0.8340893", "0.83363867", "0.83363867", "0.8331558", "0.82545733", "0.81452745", "0.814375", "0.8135387", "0.8126432", "0.80925727", "0.8086306", "0.80725205", "0.803857", "0.8030969", "0.80052185", "0.80052185", "0.80052185", "0.80052...
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.8429592", "0.8347019", "0.8347019" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n ...
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916",...
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @va...
[ "0.6719518", "0.6719518", "0.666832", "0.66565555", "0.6586841", "0.6452931", "0.6414911", "0.6414911", "0.6382046", "0.6346188", "0.6302933", "0.62237245", "0.6151989", "0.6101756", "0.60795677", "0.60795677", "0.60717124", "0.6035991", "0.6021168", "0.5936472", "0.5903488",...
0.0
-1
The number of seconds over which a volume change is ramped. For example, to fade from unity gain down to silence over the course of 1 second, set this parameter to 1 and then set the kAudioQueueParam_Volume parameter to 0.
def volume_ramp_seconds=(f) raise ArgumentError, "Volume ramp time must be 0.0 or greater" unless f.to_f >= 0.0 set_audio_queue_param KAudioQueueParam_VolumeRampTime, f.to_f self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def music_volume=(value)\n return unless value.between?(0, 100)\n @music_volume = Audio.music_volume = value\n end", "def sfx_volume=(value)\n return unless value.between?(0, 100)\n @sfx_volume = Audio.sfx_volume = value\n end", "def music_volume=(value)\n value = value.to_i.abs\n ...
[ "0.65296304", "0.642823", "0.63377386", "0.6310008", "0.6280892", "0.62243867", "0.6205223", "0.6143301", "0.5978104", "0.58967656", "0.588542", "0.5813485", "0.5782635", "0.57625014", "0.57470596", "0.56269497", "0.56110466", "0.5575344", "0.5573323", "0.55243635", "0.550644...
0.7620144
0
Generic AudioQueue parameter setter
def set_audio_queue_param(name, value) set_audio_queue_param_in_c @state, name, value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_audio_queue_param(name)\n get_audio_queue_param_in_c @state, name\n end", "def queue(queue)\n @configuration.queue = queue\n end", "def set=(value)\n @queue << \"set #{value}\"\n end", "def model_queue=(value)\n unless model_queue == value\n @configured...
[ "0.69809604", "0.59852505", "0.5656789", "0.5632446", "0.5547403", "0.5532086", "0.5517324", "0.54820615", "0.548119", "0.54807097", "0.54781395", "0.54511446", "0.5440349", "0.5422886", "0.54197", "0.53969085", "0.5389935", "0.5343971", "0.5334289", "0.5307238", "0.529002", ...
0.81191117
0
Generic AudioQueue parameter getter
def get_audio_queue_param(name) get_audio_queue_param_in_c @state, name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_audio_queue_param(name, value)\n set_audio_queue_param_in_c @state, name, value\n end", "def get_audio\n return @audio\n end", "def to_param\n queue.to_param + ',' + ppg\n end", "def queue(queue_name)\n @queues[queue_name]\n end", "def name\n @queue_string\n ...
[ "0.69697016", "0.59353065", "0.580364", "0.5793985", "0.5792617", "0.5772998", "0.5740873", "0.57151145", "0.56977326", "0.56410897", "0.56401634", "0.5639041", "0.56340003", "0.55837166", "0.5515641", "0.5484639", "0.54432404", "0.5439647", "0.5399487", "0.53815347", "0.5371...
0.81335384
0
Use callbacks to share common setup or constraints between actions.
def set_beer_profile @beer_profile = BeerProfile.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 beer_profile_params params.require(:beer_profile).permit(:appearance_head_size, :appearance_head_texture, :appearance_head_color, :appearance_head_retention, :appearance_lacing, :appearance_body_opacity, :appearance_body_carbonation, :appearance_color, :appearance_notes, :aroma_malt, :aroma_hops, :aroma_esters, :aroma_phenols, :aroma_bitterness, :aroma_flavor_grain, :aroma_flavor_hops, :aroma_flavor_fruit, :aroma_flavor_herbs, :aroma_flavor_funk, :aroma_flavor_mineral, :aroma_flavor_other, :aroma_notes, :taste_malt, :taste_hops, :taste_esters, :taste_phenols, :taste_bitterness, :taste_flavor_grain, :taste_flavor_hops, :taste_flavor_fruit, :taste_flavor_herbs, :taste_flavor_funk, :taste_flavor_mineral, :taste_flavor_other, :taste_notes, :mouth_body, :mouth_carbonation, :mouth_alcohol, :mouth_richness, :mouth_astringency, :mouth_finish, :mouth_notes, :flavor_esters, :flavor_alcoholic, :flavor_citrus, :flavor_hoppy, :flavor_floral, :flavor_spicy, :flavor_malty, :flavor_toffee, :flavor_burnt, :flavor_sweet, :flavor_sour, :flavor_bitter, :flavor_astringent, :flavor_full_bodied, :beer_id, :flavor_lingers, :image_path, :name, :style, :brewery, :abv, :rating, :notes) 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
get organization to wich record belongs
def organization id = if params[:organization_id] params[:organization_id] elsif params.dig(:q, :parent_id_eq) params[:q][:parent_id_eq] elsif params.dig(model.name.underscore.to_sym, :organization_id) params[model.name.underscore.to_sym][:organization_id] end Organization.where(id: id).first || @record&.organization || OpenStruct.new(id: nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization\n self[:O]\n end", "def organization\n records do |instance|\n instance['organization'] = organizations.where('_id': instance['organization_id']).last\n end\n end", "def organization\n id = Location.where(id: self.id).joins(:visits).select([:organization_id])\n Organi...
[ "0.7671309", "0.7590111", "0.74053186", "0.7368742", "0.73326176", "0.73269224", "0.727033", "0.721952", "0.71120566", "0.7028617", "0.70262086", "0.70150554", "0.69929546", "0.69098437", "0.6840053", "0.6803082", "0.67706865", "0.67706865", "0.6759146", "0.67572993", "0.6757...
0.7625869
1
GET /criticals GET /criticals.json
def index @criticals = Critical.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def index\n @frontend_critics = Frontend::Critic.all\n \n \n end", "def index\n\n @critical_success_facto...
[ "0.6586248", "0.60625064", "0.5932432", "0.5877715", "0.57960224", "0.5792514", "0.57745034", "0.5764683", "0.5686689", "0.5664284", "0.55759317", "0.5568357", "0.55605555", "0.5526968", "0.5523989", "0.5523552", "0.5514333", "0.5505386", "0.5501106", "0.5489986", "0.54887706...
0.7299095
0
GET /criticals/1 GET /criticals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @criticals = Critical.all\n end", "def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end", "def set_critical\n @critical = Critical.find(params[:id])\n ...
[ "0.72182596", "0.65039486", "0.6348384", "0.6282027", "0.6243692", "0.58928293", "0.5880334", "0.5878681", "0.5774053", "0.56855667", "0.56393135", "0.560394", "0.5574043", "0.55712724", "0.55539715", "0.5547502", "0.55362654", "0.552567", "0.5512649", "0.5506044", "0.5500897...
0.0
-1
POST /criticals POST /criticals.json
def create @critical = Critical.new(critical_params) respond_to do |format| if @critical.save format.html { redirect_to @critical, notice: 'Critical was successfully created.' } format.json { render :show, status: :created, location: @critical } else format.html { render :new } format.json { render json: @critical.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def critical_params\n params.require(:critical).permit(:result_id, :karuta_id, :field_id)\n end", "def index\n @criticals = Critical.all\n end", "def update\n respond_to do |format|\n if @critical.update(critical_params)\n format.html { redirect_to @critical, notice: 'Critical was su...
[ "0.609218", "0.6027436", "0.57904243", "0.5725144", "0.568931", "0.5526846", "0.54694545", "0.53782296", "0.5369197", "0.53581274", "0.53527737", "0.5301235", "0.52764106", "0.51316017", "0.5091253", "0.50326383", "0.5019736", "0.50061804", "0.4968681", "0.4960472", "0.495768...
0.7200634
0
PATCH/PUT /criticals/1 PATCH/PUT /criticals/1.json
def update respond_to do |format| if @critical.update(critical_params) format.html { redirect_to @critical, notice: 'Critical was successfully updated.' } format.json { render :show, status: :ok, location: @critical } else format.html { render :edit } format.json { render json: @critical.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @critical_factor = CriticalFactor.find(params[:id])\n\n respond_to do |format|\n if @critical_factor.update_attributes(params[:critical_factor])\n format.html { redirect_to @critical_factor, notice: 'Critical factor was successfully updated.' }\n format.json { head :no_content...
[ "0.6041236", "0.59249586", "0.58380127", "0.5836701", "0.57408124", "0.57157254", "0.5695737", "0.569416", "0.56373686", "0.5620682", "0.56185555", "0.5616036", "0.5611487", "0.5603247", "0.5587762", "0.5586516", "0.55805725", "0.5541379", "0.5531098", "0.55283463", "0.551660...
0.71221936
0
DELETE /criticals/1 DELETE /criticals/1.json
def destroy @critical.destroy respond_to do |format| format.html { redirect_to criticals_url, notice: 'Critical was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def maintenance_delete(statuspage_id, maint...
[ "0.67113656", "0.66680175", "0.6557594", "0.6550471", "0.6530817", "0.64899784", "0.6478516", "0.6404441", "0.6355222", "0.6334299", "0.63148814", "0.63118654", "0.6306039", "0.63056016", "0.6292145", "0.6280754", "0.62794375", "0.6274758", "0.6252844", "0.6214071", "0.621085...
0.74246365
0
Use callbacks to share common setup or constraints between actions.
def set_critical @critical = Critical.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 critical_params params.require(:critical).permit(:result_id, :karuta_id, :field_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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
=> [] Build Main Method
def no_consecutive_repeats?(arr) (0...arr.length - 1).each_with_index do |elm, i| return false if arr[i] == arr[i + 1] end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n end", "def main\n\n end", "def build; end", "def main; end", "def run_main\n end", "def make; end", "def build\r\n end", "def build\r\n end", "def main\n\nend", "def main\n @app.main\n end", "def main\n self\n end", "def main\n @workspace.main\n end", "...
[ "0.73500764", "0.7321962", "0.72827744", "0.72494924", "0.70397455", "0.69888854", "0.68469054", "0.68469054", "0.68430865", "0.6782616", "0.6741659", "0.67027956", "0.6634123", "0.6631525", "0.66003346", "0.6535", "0.6500568", "0.64301693", "0.63735944", "0.63652474", "0.634...
0.0
-1
=> true Build Main Method
def char_indices(str) indicies = Hash.new { |h, k| h[k] = [] } str.each_char.with_index do |char, idx_1| indicies[char] << idx_1 end indicies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_main\n end", "def main\n end", "def main\n\n end", "def build; end", "def main; end", "def build\r\n end", "def build\r\n end", "def main\n\nend", "def make; end", "def main\n @app.main\n end", "def build!\n end", "def main\n self\n end", "def build()\n HP...
[ "0.71245337", "0.71213514", "0.7097515", "0.70322317", "0.69240457", "0.66926324", "0.66926324", "0.6637383", "0.6601706", "0.65742904", "0.6520818", "0.6493196", "0.64846057", "0.6440196", "0.6440196", "0.6435983", "0.6428819", "0.642591", "0.6421627", "0.64029515", "0.63694...
0.0
-1
creates a new point from p1 in the direction of p2p3 with length d params are Point3d, 2 vertices, a length, returns a Point3d
def translate(p1, p2, p3, d) v = p3 - p2 v.length = d trans=Geom::Transformation.translation(v) return p1.transform(trans) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)\r\n end", "def translate(p1, p2, p3, d)\r\n v = p3 - p2\r\n v.length = d\r\n trans=Geom::Transformation.translation(v)\r\n return p1.transform(trans)...
[ "0.66674346", "0.66674346", "0.6629884", "0.64604485", "0.64350307", "0.61783683", "0.61386555", "0.59971577", "0.5900266", "0.58275586", "0.5819226", "0.5789013", "0.57585657", "0.57468617", "0.5725194", "0.56914926", "0.56740427", "0.56636536", "0.5586269", "0.5572696", "0....
0.66711444
0
Display all steps for all versions of a given object
def index # This ought to be a redirect, but our infrastructure is making it a # challenge to do right now: https://github.com/sul-dlss/workflow-server-rails/pull/162#issuecomment-479191283 # so we'll just ignore an log it. # return redirect_to "/objects/#{params[:druid]}/workflows" if params[:repo] logger.warn 'Workflows#index with repo parameter is deprecated. Call /objects/:druid/workflows instead' if params[:repo] object_steps = WorkflowStep.where(druid: params[:druid]) .order(:workflow, created_at: :asc) .group_by(&:workflow) @workflows = object_steps.map do |wf_name, workflow_steps| Workflow.new(name: wf_name, repository: workflow_steps.first.repository, druid: params[:druid], steps: workflow_steps) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @steps = Step.all\n end", "def show\n @step = @script.steps.build\n end", "def index\n @step_commands = StepCommand.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n @steps = Step.all\n end", "def index\n ...
[ "0.60006547", "0.58844477", "0.5867376", "0.585122", "0.585122", "0.585122", "0.585122", "0.5770651", "0.5753577", "0.5694209", "0.5662311", "0.5622382", "0.56046426", "0.5558229", "0.55209774", "0.5512306", "0.5478409", "0.54612607", "0.54291916", "0.5428389", "0.54196846", ...
0.0
-1
Display all steps for all workflows for all versions of a given object
def show workflow_steps = WorkflowStep.where( repository: params[:repo], druid: params[:druid], workflow: params[:workflow] ).order(:workflow, created_at: :asc) @workflow = Workflow.new(name: params[:workflow], repository: params[:repo], druid: params[:druid], steps: workflow_steps) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @active_workflow_steps = ActiveWorkflowStep.all\n end", "def index\n @steps = Step.all\n end", "def index\n # This ought to be a redirect, but our infrastructure is making it a\n # challenge to do right now: https://github.com/sul-dlss/workflow-server-rails/pull/162#issuecomme...
[ "0.63571095", "0.61902595", "0.60026044", "0.5979708", "0.5979708", "0.5979708", "0.5979708", "0.59526116", "0.58839446", "0.5822742", "0.58182186", "0.5800959", "0.57493603", "0.57430655", "0.5726761", "0.57024866", "0.5688882", "0.5676151", "0.56247324", "0.5556229", "0.545...
0.55035865
20
current_val = start_val while current_val <= end_val yield(current_val) current_val += step_val end end_val end alt
def step(start_val, end_val, increment) current_val = start_val until current_val > end_val yield(current_val) current_val += increment end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(first, last, step_val)\n while first <= last\n yield(first)\n first += step_val\n end\nend", "def step(value, end_value, step)\n loop do\n yield(value)\n break if value + step > end_value\n value += step\n end\n value\nend", "def step(start_point, end_point, increment)\n current_v...
[ "0.81851995", "0.80758226", "0.7961832", "0.7948853", "0.7913087", "0.7653241", "0.7413683", "0.7124647", "0.70105064", "0.66410196", "0.65568894", "0.6551412", "0.6465445", "0.6454859", "0.6428158", "0.6409673", "0.6359471", "0.6357497", "0.63206136", "0.6304117", "0.6296032...
0.86245054
0
Creates a Thumbnail object set to work on the +file+ given. It will attempt to transform the image into one defined by +target_geometry+ which is a "WxH"style string. +format+ will be inferred from the +file+ unless specified. Thumbnail creation will raise no errors unless +whiny_thumbnails+ is true (which it is, by default.
def initialize file, target_geometry, format = nil, convert_options = nil, whiny_thumbnails = true @file = file @crop = target_geometry[-1,1] == '#' @target_geometry = Geometry.parse target_geometry @current_geometry = Geometry.from_file file @convert_options = convert_options @whiny_thumbnails = whiny_thumbnails @current_format = File.extname(@file.path) @basename = File.basename(@file.path, @current_format) @format = format end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_thumbnail(source, target)\n command_exec(:create_thumbnail, [quote(source), quote(target)])\n end", "def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end", "def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::A...
[ "0.6144812", "0.599061", "0.59100425", "0.58497846", "0.5695557", "0.56601393", "0.56577945", "0.5629479", "0.56132466", "0.5568566", "0.55481565", "0.54750776", "0.5463105", "0.5459535", "0.5430489", "0.5424874", "0.5305274", "0.52988714", "0.5295168", "0.5270394", "0.521617...
0.6647053
0
Returns true if the +target_geometry+ is meant to crop.
def crop? @crop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cropping?\n !!crop_x and !!crop_y and !!crop_w and !!crop_h\n end", "def cropping?\n !self.crop_x.blank? && !self.crop_y.blank? && !self.crop_w.blank? && !self.crop_h.blank?\n end", "def cropping?\n !crop_x.blank? && !crop_y.blank? && !crop_ratio.blank?\n end", "def cropping?\n !crop...
[ "0.68619186", "0.68160534", "0.6815786", "0.6773384", "0.66860837", "0.66860837", "0.66860837", "0.66843265", "0.6436761", "0.6436761", "0.6323978", "0.62947667", "0.5832652", "0.5744961", "0.566996", "0.5637615", "0.55424815", "0.54947644", "0.53743124", "0.5290529", "0.5286...
0.7004288
1
Performs the conversion of the +file+ into a thumbnail. Returns the Tempfile that contains the new image.
def make src = @file dst = Tempfile.new([@basename, @format].compact.join(".")) dst.binmode command = <<-end_command #{ Paperclip.path_for_command('convert') } "#{ File.expand_path(src.path) }" #{ transformation_command } "#{ File.expand_path(dst.path) }" end_command success = system(command.gsub(/\s+/, " ")) if success && $?.exitstatus != 0 && @whiny_thumbnails raise PaperclipError, "There was an error processing this thumbnail" end dst end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make\n src = @file\n dst = Tempfile.new([@basename, @format ? \".#{@format}\" : ''])\n dst.binmode\n\n begin\n parameters = []\n parameters << source_file_options\n parameters << \":source\"\n parameters << transformation_command\n parameters << convert_op...
[ "0.6943248", "0.6763047", "0.67191416", "0.6635905", "0.6635822", "0.6564918", "0.6375429", "0.63513464", "0.63405436", "0.6330584", "0.63057804", "0.62847596", "0.6276489", "0.62227774", "0.6217346", "0.6210289", "0.61796016", "0.6173975", "0.6160672", "0.6157392", "0.612647...
0.69028807
1
Returns the command ImageMagick's +convert+ needs to transform the image into the thumbnail.
def transformation_command scale, crop = @current_geometry.transformation_to(@target_geometry, crop?) trans = "-scale \"#{scale}\"" trans << " -crop \"#{crop}\" +repage" if crop trans << " #{convert_options}" if convert_options trans end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_thumbnail(image)\n #FIXME - make the path consistent with working tree files.\n # the current proess relies on Glimage paths which we don't have.\n geo = Rails.application.config.thumbnail_geometry.nil? ? \"100\" : Rails.application.config.thumbnail_geometry\n cmd = Escape.shell_command [\"c...
[ "0.68891555", "0.6525557", "0.6401056", "0.61970586", "0.6116323", "0.6024878", "0.5893818", "0.58462715", "0.5787534", "0.5783877", "0.5631446", "0.5612085", "0.5603082", "0.558991", "0.5576677", "0.5568756", "0.5538969", "0.5505945", "0.5465803", "0.5444755", "0.5414028", ...
0.64889836
2
Adds leading 0 to integer
def format_time(time) format('%02d', time) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leading_zero_number(digits: 10)\n \"0#{(2..digits).collect { digit }.join}\"\n end", "def left_pad_with_zero(number)\n if (number.to_s.length == 1)\n \"0#{number}\"\n else\n number\n end\nend", "def ensurezero(prefix)\n prefix < 10 ? prefix.to_s.rjust(2, \"0\") : prefix\n end",...
[ "0.78169197", "0.7808966", "0.7700957", "0.7609791", "0.7462179", "0.7295401", "0.72594213", "0.70091856", "0.6932634", "0.67227155", "0.6702335", "0.6697707", "0.6671078", "0.6602141", "0.656253", "0.6541096", "0.6507721", "0.6504384", "0.6456075", "0.6449378", "0.6308297", ...
0.5893488
49
Takes care of case where range is outside 0 360
def determine_angle(angle, range) range.include?(angle) ? angle.to_f : angle.divmod(MAX_DEGREE_RANGE).last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(min, max)\n @min = min % 360\n @max = @min + ((max - min == 360) ? 360 : (max - min) % 360)\n end", "def convert_input(any_value_float)\n n, degrees_remaining = any_value_float.divmod(360)\n if degrees_remaining >= 0\n degrees_remaining\n elsif\n degrees_remaining < 0\n de...
[ "0.72446096", "0.6676544", "0.6603041", "0.63707036", "0.63088554", "0.6288733", "0.60881275", "0.5969975", "0.5887327", "0.58531076", "0.5835849", "0.58314234", "0.58229494", "0.5754807", "0.5750598", "0.57504994", "0.57274294", "0.56972617", "0.56883585", "0.5670173", "0.56...
0.69198
1
then use a proc. Block functions are tied more to a method call. Also note that a method can only really take one block function at a time. When a block is passed like this and stored in a variable, it is automatically converted to a proc.
def print_my_name(&blk) # It's possible to pass args to a block! The args can then be used when # invoking the method blk.call('ronan', 'duddy') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_a_proc(&block)\n block.call\nend", "def block_to_proc(&p)\n\tp.call\nend", "def run_block\n p = Proc.new # <1>\n p.call\nend", "def run_block\n p = Proc.new\n p.call\nend", "def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current sc...
[ "0.7948057", "0.7926133", "0.7899284", "0.78986835", "0.77184886", "0.75985986", "0.7590381", "0.7400139", "0.7376904", "0.73523843", "0.7318114", "0.72879", "0.72612613", "0.72336185", "0.7208938", "0.7196692", "0.7178561", "0.7164748", "0.7162479", "0.7149046", "0.7133468",...
0.0
-1
==== relationship between mysql, mongodb document
def eager_load(subject, clzz = nil) if subject.kind_of?(Smartrent::Resident) @smartrent_resident = subject elsif subject.kind_of?(Unit) @unit = subject end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populatemongonetwork\n \n db = Mongo::Connection.new(\"localhost\", 27017).db(\"networks\")\n \n #coll = db.collection(\"masterNetwork\")\n \n Network.where(\"degree=1\").find_each(:batch_size => 5000) do |network| \n coll = db.collection(network['facebook_id'])\n #doc = {\"_id\"=> User.find_by_fa...
[ "0.63901424", "0.6240984", "0.61818665", "0.61818665", "0.61818665", "0.6082923", "0.6058207", "0.6029718", "0.6014045", "0.59167355", "0.58806956", "0.58366436", "0.576448", "0.5762752", "0.5750112", "0.57325476", "0.5696854", "0.56799304", "0.56799304", "0.564914", "0.56345...
0.0
-1
order by created_at desc
def ordered_activities @ordered_activities ||= activities.sort{|a, b| b.created_at <=> a.created_at} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_timestamp\n self.created_at\n end", "def default_sort\n 'created_at desc'\n end", "def rev_order\n\t \torder(created_at: :desc)\n\t end", "def posts\n Post.all(self).sort_by { |entry| entry.created }.reverse\n end", "def recent\n self.order('created_at DESC')\n en...
[ "0.765252", "0.7626498", "0.74647355", "0.7414779", "0.7378913", "0.7193104", "0.7135254", "0.7132246", "0.7132246", "0.7105249", "0.70831186", "0.7034281", "0.7010848", "0.6961859", "0.69579136", "0.69559515", "0.69542974", "0.69456553", "0.6944499", "0.6934087", "0.6850227"...
0.6253318
98
TODO: add activity archiver once activity list grow big
def archived_activities(skip = 0, limit = 100) ArchivedResidentActivity.where(:resident_id => id.to_s).order_by(:created_at => :desc).skip(skip).limit(limit).collect{|a| activities.new(a.to_attrs) } # DO NOT SAVE entry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def publish_ac...
[ "0.6123026", "0.60562164", "0.6012821", "0.60040444", "0.5979667", "0.59260356", "0.5911249", "0.59111744", "0.58487827", "0.58329606", "0.58086264", "0.5807957", "0.5798707", "0.57844746", "0.57813466", "0.5774462", "0.576409", "0.5718473", "0.5713139", "0.5711496", "0.56826...
0.6098336
1
order by created_at asc
def ordered_sources @ordered_sources ||= sources.sort{|a, b| a.created_at <=> b.created_at} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_timestamp\n self.created_at\n end", "def earliest_order!\n # order(created_at: :asc)\n all.to_a.sort_by {|n| n.created_at }\n end", "def default_sort\n 'created_at desc'\n end", "def index\n @posts = Post.created_at_order\n end", "def index\n @posts = Post.all.sor...
[ "0.78721404", "0.7708564", "0.7675445", "0.7353604", "0.7296846", "0.7279244", "0.7261181", "0.7112536", "0.7056102", "0.70545673", "0.7032242", "0.7026062", "0.6988835", "0.69199574", "0.6867597", "0.6852254", "0.6852254", "0.6746963", "0.67219543", "0.67152816", "0.66950715...
0.0
-1
for resident cleaner, resident property callback
def to_unified_status status = nil statues = [] units.each{|u| statues << u.status } if statues.any? {|s| s == "Current"} status = "resident_current" elsif statues.any? {|s| s == "Future"} status = "resident_future" elsif statues.any? {|s| s == "Past"} status = "resident_past" elsif statues.any? {|s| s == "Notice"} status = "resident_notice" end status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property(name); end", "def transferred_properties; end", "def transferred_properties; end", "def method_missing(method, *args, &block)\n attribute = method.to_s\n\n if attribute =~ /=$/ # Define property -- does not have to exist\n attribute = attribute.chop\n self.changed_attribu...
[ "0.6228384", "0.60024816", "0.60024816", "0.59202635", "0.59103554", "0.5819653", "0.5812411", "0.5812411", "0.5812411", "0.5812411", "0.5812411", "0.5812411", "0.5812411", "0.5812411", "0.5779205", "0.57497716", "0.5727468", "0.5715588", "0.5707623", "0.56924945", "0.5681115...
0.0
-1
GET /usuarios_mobiles GET /usuarios_mobiles.json
def index @usuarios_mobiles = UsuariosMobile.all.order(:login) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usuarios_mobile\n @usuarios_mobile = UsuariosMobile.find(params[:id])\n end", "def usuarios_mobile_params\n params.require(:usuarios_mobile).permit(:login, :senha, :colaborador_id, :super_usuario)\n end", "def index\n @all_mobiles = AllMobile.all\n end", "def get_all_device_info\n...
[ "0.7300777", "0.6299603", "0.6285336", "0.6226374", "0.61783624", "0.61531234", "0.61346334", "0.6089961", "0.6076187", "0.60689825", "0.60602653", "0.60424757", "0.60029703", "0.5980278", "0.59411824", "0.593358", "0.5929434", "0.5918552", "0.59070367", "0.58919024", "0.5888...
0.69187784
1
GET /usuarios_mobiles/1 GET /usuarios_mobiles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usuarios_mobile\n @usuarios_mobile = UsuariosMobile.find(params[:id])\n end", "def index\n @usuarios_mobiles = UsuariosMobile.all.order(:login)\n end", "def new\n @mobile_user = MobileUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render jso...
[ "0.73688424", "0.67812955", "0.64781463", "0.63757735", "0.6337957", "0.6312162", "0.62849975", "0.62652653", "0.6262399", "0.620497", "0.62027866", "0.61864984", "0.6077775", "0.60773295", "0.60743237", "0.6054816", "0.6009358", "0.5979139", "0.5960387", "0.59280497", "0.591...
0.0
-1
POST /usuarios_mobiles POST /usuarios_mobiles.json
def create @usuarios_mobile = UsuariosMobile.new(usuarios_mobile_params) colaborador = Colaborador.find_by_id(params[:usuarios_mobile][:colaborador_id]) @usuarios_mobile.colaborador = colaborador respond_to do |format| if @usuarios_mobile.save format.html { redirect_to @usuarios_mobile, notice: 'Usuarios mobile criado com sucesso.' } format.json { render :show, status: :created, location: @usuarios_mobile } else format.html { render :new } format.json { render json: @usuarios_mobile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mobile_user = MobileUser.new(params[:mobile_user])\n\n respond_to do |format|\n if @mobile_user.save\n format.json { render json: @mobile_user, status: :created }\n else\n format.json { render json: @mobile_user.errors, status: :unprocessable_entity }\n end\n end...
[ "0.7114936", "0.70509964", "0.6867093", "0.6799407", "0.6644018", "0.6538417", "0.6434355", "0.64228284", "0.63087237", "0.6216945", "0.61957544", "0.61332023", "0.6085104", "0.60637826", "0.5971272", "0.59635293", "0.59439135", "0.5929422", "0.5920678", "0.5907465", "0.59058...
0.71449614
0
PATCH/PUT /usuarios_mobiles/1 PATCH/PUT /usuarios_mobiles/1.json
def update respond_to do |format| if @usuarios_mobile.update(usuarios_mobile_params) format.html { redirect_to @usuarios_mobile, notice: 'Usuarios mobile atualizado com sucesso.' } format.json { render :show, status: :ok, location: @usuarios_mobile } else format.html { render :edit } format.json { render json: @usuarios_mobile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @mobile_user = MobileUser.find(params[:id])\n\n respond_to do |format|\n if @mobile_user.update_attributes(params[:mobile_user])\n format.html { redirect_to @mobile_user, notice: 'El usuario móvil ha sido modificado con éxito' }\n format.json { head :no_content }\n else\n...
[ "0.71601623", "0.7140086", "0.6727657", "0.6511379", "0.6453648", "0.6435343", "0.6427808", "0.64196146", "0.6410935", "0.63612646", "0.6346829", "0.6313745", "0.6310997", "0.6300998", "0.6260692", "0.6254959", "0.6076073", "0.60540104", "0.60462594", "0.60271025", "0.6019167...
0.7611747
0
DELETE /usuarios_mobiles/1 DELETE /usuarios_mobiles/1.json
def destroy @usuarios_mobile.destroy respond_to do |format| format.html { redirect_to usuarios_mobiles_url, notice: 'Usuarios mobile deletado com sucesso.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mobile_user = MobileUser.find(params[:id])\n @mobile_user.destroy\n\n respond_to do |format|\n format.html { redirect_to mobile_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_user.destroy\n respond_to do |format|\n format.html ...
[ "0.7542699", "0.73678195", "0.73230004", "0.71792686", "0.70204306", "0.69976026", "0.6902747", "0.68908054", "0.6868408", "0.68576396", "0.68406427", "0.6809134", "0.6808399", "0.67998767", "0.6741494", "0.67388093", "0.6717239", "0.6708931", "0.670654", "0.670447", "0.66888...
0.80554336
0
Use callbacks to share common setup or constraints between actions.
def set_usuarios_mobile @usuarios_mobile = UsuariosMobile.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def usuarios_mobile_params params.require(:usuarios_mobile).permit(:login, :senha, :colaborador_id, :super_usuario) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
GET /state_cadres/1 GET /state_cadres/1.json
def show @state_cadre = StateCadre.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @state_cadre } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @state_cadre = StateCadre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state_cadre }\n end\n end", "def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }...
[ "0.7019488", "0.6693877", "0.64882743", "0.6428557", "0.63949156", "0.6229811", "0.6177252", "0.6176355", "0.60842", "0.6069953", "0.6069953", "0.6050509", "0.6027237", "0.60137314", "0.6007915", "0.5972574", "0.597199", "0.596204", "0.59443736", "0.5900981", "0.5895115", "...
0.75588804
0
GET /state_cadres/new GET /state_cadres/new.json
def new @state_cadre = StateCadre.new respond_to do |format| format.html # new.html.erb format.json { render json: @state_cadre } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @state_cadre = StateCadre.new(params[:state_cadre])\n\n respond_to do |format|\n if @state_cadre.save\n format.html { redirect_to @state_cadre, notice: 'State cadre was successfully created.' }\n format.json { render json: @state_cadre, status: :created, location: @state_cadre...
[ "0.7791214", "0.75943136", "0.75943136", "0.7343504", "0.7335974", "0.71614504", "0.71260256", "0.709337", "0.7092359", "0.70882636", "0.70825523", "0.70771396", "0.70723325", "0.7050879", "0.7044477", "0.7018414", "0.70004654", "0.6992169", "0.698973", "0.69885707", "0.69870...
0.8291269
0
POST /state_cadres POST /state_cadres.json
def create @state_cadre = StateCadre.new(params[:state_cadre]) respond_to do |format| if @state_cadre.save format.html { redirect_to @state_cadre, notice: 'State cadre was successfully created.' } format.json { render json: @state_cadre, status: :created, location: @state_cadre } else format.html { render action: "new" } format.json { render json: @state_cadre.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @state_cadre = StateCadre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @state_cadre }\n end\n end", "def create\n @state_copd = StateCopd.new(state_copd_params)\n\n respond_to do |format|\n if @state_copd.save\n format.ht...
[ "0.67866766", "0.6295348", "0.61225235", "0.60721815", "0.60589314", "0.60436726", "0.5991122", "0.59139264", "0.59016997", "0.58629906", "0.5862411", "0.58612376", "0.5825417", "0.58167404", "0.58031446", "0.57796556", "0.57796556", "0.57768637", "0.57747126", "0.5761814", "...
0.77453524
0
PUT /state_cadres/1 PUT /state_cadres/1.json
def update @state_cadre = StateCadre.find(params[:id]) respond_to do |format| if @state_cadre.update_attributes(params[:state_cadre]) format.html { redirect_to @state_cadre, notice: 'State cadre was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @state_cadre.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @state_cadre = StateCadre.new(params[:state_cadre])\n\n respond_to do |format|\n if @state_cadre.save\n format.html { redirect_to @state_cadre, notice: 'State cadre was successfully created.' }\n format.json { render json: @state_cadre, status: :created, location: @state_cadre...
[ "0.64439815", "0.6343115", "0.6152238", "0.6000496", "0.59951097", "0.5986567", "0.59623015", "0.58937657", "0.5886286", "0.5886286", "0.5886286", "0.5878362", "0.5830982", "0.5823388", "0.5822303", "0.5816109", "0.58098197", "0.5805014", "0.5799579", "0.57937133", "0.5791506...
0.72691303
0
DELETE /state_cadres/1 DELETE /state_cadres/1.json
def destroy @state_cadre = StateCadre.find(params[:id]) @state_cadre.destroy respond_to do |format| format.html { redirect_to state_cadres_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @expense_state = ExpenseState.find(params[:id])\n @expense_state.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @state = State.find(params[:id])\n @state.destroy\n\n ...
[ "0.6889541", "0.6784163", "0.6784163", "0.6758069", "0.67527705", "0.67442584", "0.66922724", "0.6668877", "0.6655846", "0.66527766", "0.6644288", "0.6643953", "0.66368383", "0.66342354", "0.66339433", "0.663198", "0.663198", "0.6603717", "0.65762705", "0.65411866", "0.653712...
0.78997797
0
Check if we can install Return:: _Exception_: An error, or nil in case of success
def check rError = nil if (@ProviderEnv[:Shell] == nil) rError = RuntimeError.new('This Provider does not accept Shell directories.') elsif (!File.exists?(@ProviderEnv[:Shell][:InternalDirectory])) rError = WEACE::MissingDirError.new("Missing directory: #{@ProviderEnv[:Shell][:InternalDirectory]}") end return rError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def installed?\n raise NotImplementedError\n end", "def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n ...
[ "0.7084004", "0.64758456", "0.64425105", "0.6409221", "0.6355167", "0.6349259", "0.6344272", "0.6308059", "0.62005365", "0.61869955", "0.61710954", "0.6141628", "0.61061144", "0.6098421", "0.60618603", "0.6026097", "0.60111606", "0.5969118", "0.59571785", "0.59544224", "0.592...
0.0
-1
Install for real. This is called only when check method returned no error. Return:: _Exception_: An error, or nil in case of success
def execute # Generate the shell script that will run WEACEExecute. File.open("#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh", 'w') do |oFile| oFile << "\#!/bin/sh #{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1 " end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n raise \"Not implemented yet!\"\n end", "def install\n nil\n end", "def install_dependencies\n raise 'Not implemented'\n end", "def install\n raise NotImplementedError\n end", "def install\n raise NotImplementedError\n end", "def install\n raise Abstr...
[ "0.6630628", "0.6347691", "0.62799424", "0.6257552", "0.6257552", "0.6195017", "0.6087563", "0.6031449", "0.6019144", "0.5998843", "0.59647477", "0.5952804", "0.5881703", "0.5881703", "0.5872196", "0.5868069", "0.5868069", "0.58425766", "0.58342373", "0.58283836", "0.57373947...
0.0
-1
==Description Email sent when the user sends feedback
def user_feedback(user, type, message) @user = user @type = type @message = message mail(:subject => "User Feedback (#{type})") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback\n NotebookMailer.feedback\n end", "def feedback\n NewsletterMailer.feedback\n end", "def new_feedback\n UserMailer.new_feedback\n end", "def feedback\n end", "def feedback\n SystemMailer.user_feedback(current_user, params[:type], params[:message]).deliver!\n return_message(2...
[ "0.8192715", "0.80058956", "0.7596627", "0.7563259", "0.7544186", "0.75403506", "0.75331956", "0.7396406", "0.7394749", "0.7330706", "0.731225", "0.7300237", "0.7202536", "0.71028346", "0.7089285", "0.70765483", "0.70460516", "0.7002427", "0.6991519", "0.6940566", "0.69333446...
0.722386
12
==Description Email sent when the user receives a message
def new_message_admin(from_user, to_user, message) @from_user = from_user @to_user = to_user @message = message mail(:subject => "#{@to_user.full_name} has a new message!") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_received(message)\n @message = message\n mail to: message.email, subject: 'Message to JOT confirmation'\n end", "def received\n EnquiryMailer.received\n end", "def received\n AcademyApplicationMailer.received\n end", "def reminder_received(event)\n @event = event\n\n mail :to...
[ "0.72633886", "0.7192478", "0.715443", "0.7137274", "0.70348144", "0.6981269", "0.6861507", "0.6844936", "0.6815131", "0.67583203", "0.6742228", "0.67244834", "0.67178017", "0.67070687", "0.6684752", "0.6673675", "0.6669589", "0.6662062", "0.66486573", "0.6636269", "0.6630317...
0.0
-1
Create a composite list out of two other lists:
def +(list) Composite.new([self, list]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine(list1, list2)\n combined = []\n list1_length = list1.length\n list2_length = list2.length\n until list1.empty? and list2.empty?\n list1_element = list1.shift\n combined << list1_element if list1_element\n list2_element = list2.shift\n combined << list2_element if list2_element\n end\n ...
[ "0.70890754", "0.6928216", "0.66368157", "0.6527487", "0.6388729", "0.6305216", "0.61896825", "0.60963213", "0.60666406", "0.6002365", "0.59590906", "0.5951784", "0.5927939", "0.59163314", "0.5911638", "0.5907481", "0.58999455", "0.5896447", "0.58888125", "0.5855226", "0.5840...
0.6310672
5
This isn't very efficient, but it IS generic.
def ==(other) if self.class == other.class self.eql?(other) elsif other.kind_of? self.class self.to_a.sort == other.to_a.sort else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def generic?; true; end", "def same; end", "def each_identity; end", "def double_collections_by_parameter_name; end", "def double_collections_by_parameter_name; end", "def overload; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def base...
[ "0.5810643", "0.5352655", "0.5266141", "0.50753057", "0.5054546", "0.5054546", "0.5050813", "0.5045285", "0.5045285", "0.5045285", "0.5045285", "0.5031579", "0.5020672", "0.50174725", "0.4988545", "0.49816173", "0.49816173", "0.49623093", "0.492807", "0.49208623", "0.49151894...
0.0
-1
Does this list of files include the path of any other?
def intersects? other other.any?{|path| include?(path)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lib_files\n @files.select do |file|\n require_paths.any? do |path|\n file.start_with? path\n end\n end\n end", "def include?(file)\n @file_list.include?(file.basename)\n end", "def files_with_duplicate_imports\n files.select(&:has_duplicate_import?)\n end", "def ig...
[ "0.720702", "0.68082386", "0.6787253", "0.6586865", "0.6571281", "0.65484226", "0.65459704", "0.64721394", "0.64346445", "0.6407147", "0.6379445", "0.63768524", "0.6370017", "0.6365448", "0.62246215", "0.62222975", "0.6190004", "0.6186846", "0.6185823", "0.618366", "0.6176111...
0.0
-1
node / \ self >> [rest of children]
def parent=(node) if self.parent self.parent.children.delete(self) end @parent = node node.children << self unless node == nil || node.children.include?(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_child_nodes(node); end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", ...
[ "0.74696136", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.7337268", "0.73313344", "0.7197449", "0.7197449", "0.70473355", "0.7028911", "0.70173407", "0.6880891", "0.67495155"...
0.0
-1
This script filters the repositories found by the OhlohJavaGitRepoFetcher.rb script, such that there is always only one Git repository per project. It tries to evaluate the best link. The input is expected to be tab separated: definition:nametypeurl example: Apache Maven 2maven2Git master or: Apache Maven 2maven2Git(via SyncHost) master prefer "src" / "source" / "core" / "standard" / "build" / "master" appears in url prefer normalized name appearing multiple times ( prefer short url prefer Git repos sort descending and choose first result after ranking
def filterRepositories Enumerator.new { |repos| while (gets) repo = Repo.new $_.sub!(/\(via.*?\)/, '') # Remove 'via' annotation in line. repo.name, repo.type, repo.url = $_.split(/\s+/) repo.score = 0 repos << repo end }.group_by{|repo| repo.name}.values.each{|repoList| printBest repoList } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_repo\n matches = @source_url.match @github_regexp\n return unless matches\n owner = matches[:owner]\n name = matches[:name]\n \"#{owner}/#{name}\"\n end", "def find_by_matching_url(url)\n [url, url.sub('.git', ''), \"#{url.sub('.git', '')}.git\"].uniq.map do |lookup_url|\n ...
[ "0.60068136", "0.59881663", "0.5952813", "0.5895387", "0.58889914", "0.58350986", "0.5729286", "0.571676", "0.5641535", "0.5497847", "0.5497213", "0.5420184", "0.5417682", "0.54158217", "0.54079765", "0.53916657", "0.53713953", "0.53550786", "0.53386545", "0.5332912", "0.5326...
0.73760223
0
calculates number of rides per driver
def number_rides(whatever) whatever.each do |key,value| y = "Driver #{key} has #{(value.length)} ride(s)." puts y end puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_rides_per_driver(ride_data)\n number_of_rides = {}\n # access driver's IDs to be used as keys in hash \"ride_info\", then\n # access the cost of each ride per driver, to be the corresponding value\n ride_data.length.times do |driver_index|\n driver_id = ride_data[driver_index][:driver_id]\n ...
[ "0.8322564", "0.8086752", "0.7893067", "0.7861353", "0.7843947", "0.78362024", "0.74610424", "0.73775053", "0.736447", "0.73252875", "0.7259498", "0.71635735", "0.71173626", "0.7096462", "0.70175546", "0.6967922", "0.69476885", "0.6919113", "0.68840086", "0.6859375", "0.68357...
0.55112535
90