- The first
model
argument is the model class - The second argument
find_or_create_by
is a hash of attributes that are used for finding a record. If the record doesn't exist, it will be created. This hash is like the unique identifier of a seed record. - The third argument
update_with
is a hash of attributes that will be always set on the record, whether the record already exists or has to be created. This is useful when the seeds are extended and you want to update existing records with new attributes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bundle/ |
Moved to https://github.com/metaflop/metaflop-www/wiki/Contribute-a-MF-to-Metaflop
This is a rough draft, work in progress
The structure is planned to change, but for now this is how a metaflop font should look like to be compatible with metaflop.
- Create the required files structure, have a look at e.g. https://github.com/metaflop/metaflop-font-bespoke and https://github.com/metaflop/metaflop-font-fetamont.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Help output | |
help() { | |
echo "Usage: git-fame [options] <repository_path>" | |
echo " -m Machine readable output" | |
echo " -h Print this help" | |
exit 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: spec/models/base_spec.rb | |
require 'rails_helper' | |
RSpec.describe 'All ActiveRecord::Base models' do | |
context 'has_many with :dependent key' do | |
each_active_record_model do |model| | |
has_many_relations(model).each do |has_many_relation| | |
it "has :dependent defined on the #{model}##{has_many_relation.name} relation" do | |
expect(has_many_relation.options[:dependent]).not_to be_nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# try pairs of 2 | |
def pairs_of_2(names) | |
slices = names.join.scan(/.{2}/) | |
combinations(slices) | |
end | |
# try each chars | |
def pairs_of_chars(names) | |
chars = names.join.chars.to_a.uniq | |
combinations(combinations(chars)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
ruby solver | |
=end | |
$count = 0 | |
def valid?(state, x, y) | |
# check in col and row | |
0.upto(8) do |i| | |
return false if i != y and state[x][i] == state[x][y] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Diagnostics; | |
namespace ConsoleApplication1 | |
{ | |
public class Program | |
{ | |
[DllImport("user32.dll")] | |
static extern IntPtr GetOpenClipboardWindow(); |
NewerOlder