Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
// Create a global map of users
$users: ();
// Add a new user to the global map
@mixin user($name, $availability, $infos) {
$users: append($users, (
'name': $name,
'availability': $availability,
'infos': $infos
)) !global;
}
// Display all users
@mixin display-users {
@each $user in $users {
#{'.' + map-get($user, 'name')} {
twitter: #{'@' + map-get($user, 'name')};
infos: map-get($user, 'infos');
.availability {
@each $key, $value in map-get($user, 'availability') {
#{$key}: unquote($value);
}
}
}
}
}
// Display informations
@mixin display-informations {
.beer.scss {
location: "Bierhof Rüdersdorf";
infos: url("http://www.bierhof.info");
}
}
// Add a new user
@include user(
"HugoGiraudel",
( "Monday": "18:00+", "Thursday": "18:00+" ),
"Can't guide himself in Berlin. Is mostly lost anywhere."
);
// Add a new user
@include user(
"Hagenburger",
( "Monday": "18:00+", "Thursday": "18:00+" ),
"Je ne parle pas français."
);
// Add a new user
@include user(
"PascalDuez",
( "Monday": "18:00+", "Tuesday": "18:00+", "Wednesday": "18:00+", "Thursday": "18:00+" ),
"Ick spreche'n bisschen Deutsch."
);
// Display meet up informations
@include display-informations;
// Display all users
@include display-users;
@charset "UTF-8";
.beer.scss {
location: "Bierhof Rüdersdorf";
infos: url("http://www.bierhof.info");
}
.HugoGiraudel {
twitter: @HugoGiraudel;
infos: "Can't guide himself in Berlin. Is mostly lost anywhere.";
}
.HugoGiraudel .availability {
Monday: 18:00+;
Thursday: 18:00+;
}
.Hagenburger {
twitter: @Hagenburger;
infos: "Je ne parle pas français.";
}
.Hagenburger .availability {
Monday: 18:00+;
Thursday: 18:00+;
}
.PascalDuez {
twitter: @PascalDuez;
infos: "Ick spreche'n bisschen Deutsch.";
}
.PascalDuez .availability {
Monday: 18:00+;
Tuesday: 18:00+;
Wednesday: 18:00+;
Thursday: 18:00+;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment