This file contains hidden or 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
// | |
// Disclamer: | |
// ---------- | |
// | |
// This code will work only if you selected window, graphics and audio. | |
// | |
// Note that the "Run Script" build phase will copy the required frameworks | |
// or dylibs to your application bundle so you can execute it on any OS X | |
// computer. |
This file contains hidden or 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
a = "123" | |
hash = { 1 => 'a', | |
2 => 'b', | |
3 => 'd'} | |
a = a.split('').each do |variable| | |
puts hash[variable.to_i] | |
end |
This file contains hidden or 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
class CreateMembersInOrgs < ActiveRecord::Migration | |
def change | |
create_table :members_in_orgs do |t| | |
t.integer :mio_id | |
t.integer :member_id | |
t.integer :org_id | |
t.timestamps | |
end | |
end |
This file contains hidden or 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
class Member < ActiveRecord::Base | |
has_many :members_in_orgs | |
has_many :orgs, :through => :members_in_orgs | |
end | |
class MembersInOrgs < ActiveRecord::Base | |
validates_uniqueness_of :member_id, scope: :org_id | |
belongs_to :orgs | |
belongs_to :members | |
end |
This file contains hidden or 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
#define UNECESSARY_CONSTANT 0 | |
typedef struct node { | |
String value; | |
typedef struct node next; | |
} Node; | |
/* | |
value_to_index[] = Hash(String value, int count) | |
index_to_ref[] = Hash(int count, Node* reference) |
This file contains hidden or 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
/* | |
Pretend like Strings are actually a thing | |
*/ | |
typedef struct node{ | |
String value; | |
Node* next; | |
} Node; | |
// Inserts to the front of the list |
NewerOlder