Skip to content

Commit fd7bf4f

Browse files
committed
Initial commit
0 parents  commit fd7bf4f

16 files changed

+603
-0
lines changed

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile ~/.gitignore_global
6+
7+
# Ignore bundler config
8+
/.bundle
9+
10+
# Ignore the build directory
11+
/build
12+
13+
# Ignore cache
14+
/.sass-cache
15+
/.cache
16+
17+
# Ignore .DS_store file
18+
.DS_Store
19+
20+
# Ignore Node.js modules
21+
node_modules

.jshintignore

Whitespace-only changes.

.jshintrc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"bitwise": false,
3+
"boss": true,
4+
"browser": true,
5+
"camelcase": true,
6+
"curly": true,
7+
"devel": true,
8+
"eqeqeq": true,
9+
"es3": true,
10+
"expr": true,
11+
"forin": true,
12+
"freeze": true,
13+
"globalstrict": false,
14+
"immed": true,
15+
"indent": 2,
16+
"jquery": true,
17+
"latedef": true,
18+
"laxcomma": true,
19+
"multistr": false,
20+
"newcap": true,
21+
"noarg": true,
22+
"noempty": true,
23+
"nonew": true,
24+
"notypeof": false,
25+
"plusplus": false,
26+
"quotmark": "single",
27+
"regexp": true,
28+
"strict": true,
29+
"trailing": true,
30+
"undef": true,
31+
"unused": true,
32+
"maxparams": 5,
33+
"maxdepth": 4,
34+
"maxstatements": 20,
35+
"maxcomplexity": 10,
36+
"globals": {"module": true, "require": true, "suite": true, "test": true, "__dirname": true}
37+
}

Gemfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# If you have OpenSSL installed, we recommend updating
2+
# the following line to use "https"
3+
source 'http://rubygems.org'
4+
5+
gem "middleman", "~>3.3.2"
6+
7+
# Live-reloading plugin
8+
gem "middleman-livereload", "~> 3.1.0"
9+
10+
# For faster file watcher updates on Windows:
11+
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
12+
13+
# Windows does not come with time zone data
14+
gem "tzinfo-data", platforms: [:mswin, :mingw]

Gemfile.lock

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
activesupport (4.0.4)
5+
i18n (~> 0.6, >= 0.6.9)
6+
minitest (~> 4.2)
7+
multi_json (~> 1.3)
8+
thread_safe (~> 0.1)
9+
tzinfo (~> 0.3.37)
10+
chunky_png (1.3.0)
11+
coffee-script (2.2.0)
12+
coffee-script-source
13+
execjs
14+
coffee-script-source (1.7.0)
15+
compass (0.12.6)
16+
chunky_png (~> 1.2)
17+
fssm (>= 0.2.7)
18+
sass (~> 3.2.19)
19+
compass-import-once (1.0.4)
20+
sass (>= 3.2, < 3.5)
21+
em-websocket (0.5.1)
22+
eventmachine (>= 0.12.9)
23+
http_parser.rb (~> 0.6.0)
24+
erubis (2.7.0)
25+
eventmachine (1.0.3)
26+
execjs (2.0.2)
27+
ffi (1.9.3)
28+
fssm (0.2.10)
29+
haml (4.0.5)
30+
tilt
31+
hike (1.2.3)
32+
hooks (0.4.0)
33+
uber (~> 0.0.4)
34+
http_parser.rb (0.6.0)
35+
i18n (0.6.9)
36+
json (1.8.1)
37+
kramdown (1.3.3)
38+
listen (1.3.1)
39+
rb-fsevent (>= 0.9.3)
40+
rb-inotify (>= 0.9)
41+
rb-kqueue (>= 0.2)
42+
middleman (3.3.2)
43+
coffee-script (~> 2.2.0)
44+
compass (>= 0.12.4)
45+
compass-import-once (~> 1.0.4)
46+
execjs (~> 2.0)
47+
haml (>= 4.0.5)
48+
kramdown (~> 1.2)
49+
middleman-core (= 3.3.2)
50+
middleman-sprockets (>= 3.1.2)
51+
sass (>= 3.2.17, < 4.0)
52+
uglifier (~> 2.5)
53+
middleman-core (3.3.2)
54+
activesupport (~> 4.0.1)
55+
bundler (~> 1.1)
56+
erubis
57+
hooks (~> 0.3)
58+
i18n (~> 0.6.9)
59+
listen (~> 1.1)
60+
padrino-helpers (~> 0.12.1)
61+
rack (>= 1.4.5, < 2.0)
62+
rack-test (~> 0.6.2)
63+
thor (>= 0.15.2, < 2.0)
64+
tilt (~> 1.4.1, < 2.0)
65+
middleman-livereload (3.1.1)
66+
em-websocket (>= 0.2.0)
67+
middleman-core (>= 3.0.2)
68+
multi_json (~> 1.0)
69+
rack-livereload
70+
middleman-sprockets (3.3.3)
71+
middleman-core (>= 3.2)
72+
sprockets (~> 2.2)
73+
sprockets-helpers (~> 1.1.0)
74+
sprockets-sass (~> 1.1.0)
75+
minitest (4.7.5)
76+
multi_json (1.9.3)
77+
padrino-helpers (0.12.1)
78+
i18n (~> 0.6, >= 0.6.7)
79+
padrino-support (= 0.12.1)
80+
tilt (~> 1.4.1)
81+
padrino-support (0.12.1)
82+
activesupport (>= 3.1)
83+
rack (1.5.2)
84+
rack-livereload (0.3.15)
85+
rack
86+
rack-test (0.6.2)
87+
rack (>= 1.0)
88+
rb-fsevent (0.9.4)
89+
rb-inotify (0.9.4)
90+
ffi (>= 0.5.0)
91+
rb-kqueue (0.2.2)
92+
ffi (>= 0.5.0)
93+
sass (3.2.19)
94+
sprockets (2.12.1)
95+
hike (~> 1.2)
96+
multi_json (~> 1.0)
97+
rack (~> 1.0)
98+
tilt (~> 1.1, != 1.3.0)
99+
sprockets-helpers (1.1.0)
100+
sprockets (~> 2.0)
101+
sprockets-sass (1.1.0)
102+
sprockets (~> 2.0)
103+
tilt (~> 1.1)
104+
thor (0.19.1)
105+
thread_safe (0.3.3)
106+
tilt (1.4.1)
107+
tzinfo (0.3.39)
108+
uber (0.0.4)
109+
uglifier (2.5.0)
110+
execjs (>= 0.3.0)
111+
json (>= 1.8.0)
112+
113+
PLATFORMS
114+
ruby
115+
116+
DEPENDENCIES
117+
middleman (~> 3.3.2)
118+
middleman-livereload (~> 3.1.0)
119+
tzinfo-data
120+
wdm (~> 0.1.0)

Gruntfile.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = function(grunt) {
2+
'use strict';
3+
4+
grunt.initConfig({
5+
jshint: {
6+
all: {
7+
src: [
8+
'source/javascripts/*.js',
9+
'source/javascripts/**/*.js.erb'
10+
],
11+
options: {
12+
jshintrc: '.jshintrc'
13+
}
14+
}
15+
},
16+
watch: {
17+
scripts: {
18+
files: [
19+
'.jshintrc',
20+
'Gruntfile.js',
21+
'source/**/*.js',
22+
'source/**/*.js.erb',
23+
'.jshint'
24+
],
25+
tasks: ['jshint'],
26+
options: {
27+
interrupt: true,
28+
},
29+
},
30+
}
31+
});
32+
33+
// For this to work, you need to have run `npm install grunt-simple-mocha`
34+
grunt.loadNpmTasks('grunt-contrib-jshint');
35+
grunt.loadNpmTasks('grunt-contrib-watch');
36+
37+
// Add a default task. This is optional, of course :)
38+
grunt.registerTask('default', ['jshint', 'watch']);
39+
};

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Delicious HAML & SASS. Watched by Grunt & JSHint

config.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set :haml, { :ugly => false, :format => :html5 }
2+
3+
set :css_dir, 'stylesheets'
4+
set :js_dir, 'javascripts'
5+
set :images_dir, 'images'
6+
7+
configure :build do
8+
activate :minify_css
9+
activate :minify_javascript
10+
activate :asset_hash, :ignore => []
11+
activate :relative_assets
12+
end

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "mm-grunt-sass-haml",
3+
"version": "0.0.1",
4+
"description": "Middleman, Grunt, JSHint, SASS, HAML",
5+
"author": "semu",
6+
"devDependencies": {
7+
"grunt": "~0.4.1",
8+
"grunt-cli": "~0.1.11",
9+
"grunt-jslint": "~1.1.1",
10+
"grunt-contrib-jshint": "~0.7.2",
11+
"grunt-contrib-watch": "^0.6.1"
12+
}
13+
}

source/index.haml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#timeline

source/javascripts/lib.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function() {
2+
'use strict';
3+
4+
var Lib = {
5+
/* http://www.dustindiaz.com/smallest-domready-ever */
6+
/* jshint -W030 */
7+
ready: function r(f){ /in/.test(document.readyState)?setTimeout('Lib.ready('+f+')',9):f(); }
8+
};
9+
10+
window.Lib = Lib;
11+
})();

source/javascripts/main.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//= require_tree .
2+
3+
/* global console, Lib */
4+
5+
(function(){
6+
'use strict';
7+
8+
Lib.ready(function() {
9+
new Timeline("timeline", [
10+
['2002', '05/2007', 'Lorem ipsum dolor sit amet #1', 'lorem'],
11+
['2002', '06/2006', 'Lorem ipsum dolor sit amet #2', 'lorem'],
12+
['05/2004', '07/2004', 'Lorem ipsum dolor sit amet #3', 'ipsum'],
13+
['06/2007', 'Lorem ipsum dolor sit amet #4'],
14+
['11/2007', '03/2009', 'Lorem ipsum dolor sit amet #5', 'dolor'],
15+
['07/2008', '07/2009', 'Lorem ipsum dolor sit amet #6', 'lorem'],
16+
['01/2009', '03/2012', 'Lorem ipsum dolor sit amet #7', 'sit'],
17+
['2010', '10/2011', 'Lorem ipsum dolor sit amet #8', 'ipsum'],
18+
]);
19+
20+
});
21+
})();

source/javascripts/timesheet.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
(function() {
2+
'use strict';
3+
4+
var Timeline = function(container, data) {
5+
this.container = '#' + container;
6+
this.data = [];
7+
this.year = {
8+
min: (new Date()).getFullYear(),
9+
max: (new Date()).getFullYear()
10+
};
11+
12+
this.parse(data);
13+
this.drawSections();
14+
this.insertData();
15+
};
16+
17+
Timeline.prototype.formatMonth = function(num) {
18+
num = parseInt(num, 10);
19+
20+
return num >= 10 ? num : '0' + num;
21+
};
22+
23+
Timeline.prototype.insertData = function() {
24+
// document.querySelector(this.container).innerHTML += this.data.join('');
25+
var html = [];
26+
27+
for (var n = 0, m = this.data.length; n < m; n++) {
28+
var lne = [];
29+
var cur = this.data[n];
30+
31+
console.log(cur)
32+
33+
var line = '<span class="bubble bubble-' + (cur.type || 'default') + '" data-duration="' + (cur.end ? Math.round((cur.end-cur.start)/1000/60/60/24/39) : '') + '"></span>'
34+
+ '<span class="date">'
35+
+ (cur.start.hasMonth ? this.formatMonth(cur.start.getMonth() + 1) + '/' : '' ) + cur.start.getFullYear()
36+
+ (cur.end ? '-' + ((cur.end.hasMonth ? this.formatMonth(cur.end.getMonth() + 1) + '/' : '' ) + cur.end.getFullYear()) : '')
37+
+ '</span> '
38+
+ '<span class="label">'
39+
+ cur.label
40+
+ '</span>';
41+
42+
html.push('<li>' + line + '</li>');
43+
}
44+
45+
document.querySelector(this.container).innerHTML += '<ul class="data">' + html.join('') + '</ul>';
46+
};
47+
48+
Timeline.prototype.drawSections = function() {
49+
var html = [];
50+
51+
for (var c = this.year.min; c <= this.year.max; c++) {
52+
html.push('<section>' + c + '</section>');
53+
}
54+
55+
document.querySelector(this.container).className = 'timeline';
56+
document.querySelector(this.container).innerHTML = '<div class="scale">' + html.join('') + '</div>';
57+
};
58+
59+
Timeline.prototype.parseDate = function(date) {
60+
if (date.indexOf('/') === -1) {
61+
date = new Date(parseInt(date, 10), 0, 1);
62+
date.hasMonth = false;
63+
} else {
64+
date = date.split('/');
65+
date = new Date(parseInt(date[1], 10), parseInt(date[0], 10)-1, 1);
66+
date.hasMonth = true;
67+
}
68+
69+
return date;
70+
};
71+
72+
Timeline.prototype.parse = function(data) {
73+
for (var n = 0, m = data.length; n<m; n++) {
74+
var beg = this.parseDate(data[n][0]);
75+
var end = data[n].length === 4 ? this.parseDate(data[n][1]) : null;
76+
var lbl = data[n][2] || data[n][1];
77+
var cat = data[n][3] || 'default'
78+
79+
if (beg.getFullYear() < this.year.min) {
80+
this.year.min = beg.getFullYear();
81+
}
82+
83+
if (end && end.getFullYear() > this.year.max) {
84+
this.year.max = end.getFullYear();
85+
} else if (beg.getFullYear() > this.year.max) {
86+
this.year.max = beg.getFullYear();
87+
}
88+
89+
this.data.push({start: beg, end: end, label: lbl, type: cat});
90+
}
91+
}
92+
93+
window.Timeline = Timeline;
94+
})();

0 commit comments

Comments
 (0)