Skip to content

Instantly share code, notes, and snippets.

def while_loop(numbers)
i = 0
answer = 0
while i < (numbers.length)
answer += numbers[i]
i += 1
end
return answer
end
def find_largest(numbers)
master_list = Array.new
list = numbers.permutation.to_a
list.map do |l|
master_list << l.join
end
master_list.sort.last
end
numbers = [1, 20, 3, 49, 442]
puts find_largest(numbers)
module Denkgroot
include ActiveSupport::Configurable
config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures
self.title = "denkGroot thema"
self.page_parts = [
{ name: 'text', title: 'Text', page_partable_type: "Spina::Text" },
{ name: 'teaser', title: 'Teaser', page_partable_type: "Spina::Line" },
@arjunvenkat
arjunvenkat / gist:1115bc41bf395a162084
Last active January 12, 2024 05:04
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active May 17, 2026 22:03
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: