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
# require_and_profile.rb | |
# from http://stackoverflow.com/questions/13065408/how-to-measure-how-much-memory-each-gem-requires-at-initialization | |
def require_and_profile(gemname = nil) | |
unless gemname | |
puts "%-20s: %10s | %10s" % ['gem','increment','total'] | |
return | |
end | |
#puts "Trying #{gemname}" | |
# This is how to get memory of calling process in OS X, check host OS for variants | |
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i / 1024.0 |
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
$(function() { | |
var source = new Bloodhound({ | |
/* create source as usual... */ | |
}); | |
source.initialize(); | |
// Check if the query matches exactly | |
function noDirectMatch(matches, query) { |
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 Team < ActiveRecord::Base | |
has_and_belongs_to_many :users | |
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 Team < ActiveRecord::Base | |
has_many :team_users | |
has_many :users, :through => :team_users | |
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 CreateTeamsUsersWithId < ActiveRecord::Migration | |
def change | |
create_table :team_user_tmps do |t| | |
t.belongs_to :team, :null => false, :index => true | |
t.belongs_to :user, :null => false, :index => true | |
end | |
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 CopyTeamUsers < ActiveRecord::Migration | |
class User < ActiveRecord::Base | |
has_and_belongs_to_many :teams | |
has_many :team_user_tmps | |
has_many :teams_tmp, :through => :team_user_tmps, :source => :team | |
end | |
class Team < ActiveRecord::Base | |
has_and_belongs_to_many :users | |
has_many :team_user_tmps | |
has_many :users_tmp, :through => :team_user_tmps, :source => :user |
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 DropTeamsUsersWithoutId < ActiveRecord::Migration | |
def change | |
drop_table :teams_users | |
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 RenameTeamUsersWithId < ActiveRecord::Migration | |
def change | |
rename_table :team_user_tmps, :team_users | |
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
CLS : LOCATE 13, 1: PRINT STRING$(79, 196): MUR = 219: C = 1: X = 1: M = 16: E = 1: F = 1: B$ = "TU AS GAGNE!" | |
LOCATE 1, 1: PRINT "Appuyer sur ECHAP pour quitter" | |
LOCATE 16, 1: PRINT "=" | |
LOCATE 23, 1: PRINT STRING$(79, 196): LOCATE 13, 14: PRINT " ": A = 1 | |
LOCATE 12, 1: COLOR 2: PRINT CHR$(2): C$ = "L8O3CEGO4CO3P8GO4C4" | |
LOCATE 11, 1: PRINT "OH NON! MAIS COMMENT DONC REVENIR A LA MAISON?" | |
LOCATE 11, 55: PRINT "- - - - -": LOCATE 11, 70: PRINT "�": B = 1: S = 1 | |
LOCATE 12, 79: PRINT CHR$(127): LOCATE 12, 29: PRINT CHR$(MUR) | |
LOCATE 17, 28: PRINT STRING$(5, 196): LOCATE 15, 32: PRINT "-" | |
FOR H = 1 TO 5000: NEXT H |
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
CLS | |
LOCATE 12, 1: PRINT STRING$(78, 196) | |
X = 78 | |
FOR A = 1 TO 40: | |
LOCATE 11, X: COLOR 1: PRINT CHR$(2) | |
LOCATE 11, X + 1: PRINT " " | |
FOR B = 1 TO 500 | |
NEXT B: X = X - 1 | |
NEXT A | |
LOCATE 13, 40: PRINT "JULIEN" |