Skip to content

Loading…

Configuration for continuous integration service #3

Merged
merged 5 commits into from

2 participants

@igorlima
  • Added a travis config file.
  • Did some refactors to fix JSHint warnnings.

Travis is a hosted continuous integration service for the open source community.
Take a look here to know how easy is the configuration for continous integration service.

I hope you'll enjoy it.

@Calvein Calvein merged commit 3e09a24 into Calvein:gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 7, 2013
  1. @igorlima

    Ignore node_modules folder

    igorlima committed
  2. @igorlima

    Add travis yml file

    igorlima committed
  3. @igorlima

    Add Grunt file

    igorlima committed
  4. @igorlima

    Fix some JSHint warnnings

    igorlima committed
  5. @igorlima
Showing with 110 additions and 67 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 .travis.yml
  3. +30 −0 Gruntfile.js
  4. +11 −10 scripts/ekwal.js
  5. +3 −1 scripts/ekwal.min.js
  6. +11 −10 scripts/jquery.ekwal.js
  7. +3 −1 scripts/jquery.ekwal.min.js
  8. +44 −45 scripts/main.js
View
1 .gitignore
@@ -0,0 +1 @@
+node_modules/
View
7 .travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - "0.11"
+before_script:
+ - npm install -g grunt-cli
+ - npm install grunt grunt-contrib-jshint grunt-contrib-uglify
+script: grunt -v
View
30 Gruntfile.js
@@ -0,0 +1,30 @@
+module.exports = function(grunt) {
+ grunt.initConfig({
+
+ uglify: {
+ options: {
+ preserveComments: 'some'
+ },
+ my_target: {
+ files: {
+ 'scripts/ekwal.min.js': ['scripts/ekwal.js'],
+ 'scripts/jquery.ekwal.min.js': ['scripts/jquery.ekwal.js']
+ }
+ }
+ },
+
+ jshint: {
+ options: {
+ force: true
+ },
+ all: ['Gruntfile.js', 'scripts/ekwal.js', 'scripts/jquery.ekwal.js', 'scripts/main.js']
+ }
+
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+
+ grunt.registerTask('default', ['jshint', 'uglify']);
+
+};
View
21 scripts/ekwal.js
@@ -1,4 +1,5 @@
/**
+ * @license
* ekwal 1.0.0
*
* To use it, just call the ekwal() function with the elements you want to equalize.
@@ -17,21 +18,21 @@
* Date: Sep 14 19:45:00 2012
*/
-!function() {
+;(function(window, undefined) {
window.ekwal = function(els, prop) {
- els = [].slice.call(els)
+ els = [].slice.call(els);
// `height` is the default value
- prop = prop || 'height'
+ prop = prop || 'height';
if (prop !== 'height' && prop !== 'width')
- throw new Error('"' + prop + '" must be "height" (by default) or "width"')
+ throw new Error('"' + prop + '" must be "height" (by default) or "width"');
els.forEach(function(el) {
el.style[prop] = Math.max.apply(null, els.map(function(el) {
- return parseInt(getComputedStyle(el).getPropertyValue(prop), 10)
- })) + 'px'
- })
+ return parseInt(getComputedStyle(el).getPropertyValue(prop), 10);
+ })) + 'px';
+ });
- return els
- }
-}()
+ return els;
+ };
+}(window));
View
4 scripts/ekwal.min.js
@@ -1,4 +1,5 @@
/**
+ * @license
* ekwal 1.0.0
*
* To use it, just call the ekwal() function with the elements you want to equalize.
@@ -15,4 +16,5 @@
* http://sam.zoy.org/wtfpl/
*
* Date: Sep 14 19:45:00 2012
- */!function(){window.ekwal=function(e,t){e=[].slice.call(e),t=t||"height";if(t!=="height"&&t!=="width")throw new Error('"'+t+'" must be "height" (by default) or "width"');return e.forEach(function(n){n.style[t]=Math.max.apply(null,e.map(function(e){return parseInt(getComputedStyle(e).getPropertyValue(t),10)}))+"px"}),e}}();
+ */
+(function(t){t.ekwal=function(t,e){if(t=[].slice.call(t),e=e||"height","height"!==e&&"width"!==e)throw Error('"'+e+'" must be "height" (by default) or "width"');return t.forEach(function(n){n.style[e]=Math.max.apply(null,t.map(function(t){return parseInt(getComputedStyle(t).getPropertyValue(e),10)}))+"px"}),t}})(window);
View
21 scripts/jquery.ekwal.js
@@ -1,4 +1,5 @@
/**
+ * @license
* ekwal 1.0.0
*
* To use it, just call the jQuery#ekwal() method on the elements you want to equalize.
@@ -12,20 +13,20 @@
* Date: Sep 14 19:45:00 2012
*/
-!function($) {
+;(function($) {
$.fn.ekwal = function(jQueryDimension) {
// `height` is the default value
- jQueryDimension = jQueryDimension || 'height'
- var $els = this
- , prop = /eight/.test(jQueryDimension) ? 'height' : 'width';
+ jQueryDimension = jQueryDimension || 'height';
+ var $els = this,
+ prop = /eight/.test(jQueryDimension) ? 'height' : 'width';
if (typeof $.fn[jQueryDimension] !== 'function')
- throw new Error('$.fn.' + jQueryDimension + '() do not exist')
+ throw new Error('$.fn.' + jQueryDimension + '() do not exist');
$els[prop](Math.max.apply(null, $.map($els, function(el) {
- return $(el)[jQueryDimension]()
- })))
+ return $(el)[jQueryDimension]();
+ })));
- return $els
- }
-}(window.jQuery || window.Zepto);
+ return $els;
+ };
+}(window.jQuery || window.Zepto));
View
4 scripts/jquery.ekwal.min.js
@@ -1,4 +1,5 @@
/**
+ * @license
* ekwal 1.0.0
*
* To use it, just call the jQuery#ekwal() method on the elements you want to equalize.
@@ -10,4 +11,5 @@
* http://sam.zoy.org/wtfpl/
*
* Date: Sep 14 19:45:00 2012
-*/!function(e){e.fn.ekwal=function(t){t=t||"height";var n=this,r=/eight/.test(t)?"height":"width";if(typeof e.fn[t]!="function")throw new Error("$.fn."+t+"() do not exist");return n[r](Math.max.apply(null,e.map(n,function(n){return e(n)[t]()}))),n}}(jQuery);
+*/
+(function(t){t.fn.ekwal=function(n){n=n||"height";var e=this,i=/eight/.test(n)?"height":"width";if("function"!=typeof t.fn[n])throw Error("$.fn."+n+"() do not exist");return e[i](Math.max.apply(null,t.map(e,function(e){return t(e)[n]()}))),e}})(window.jQuery||window.Zepto);
View
89 scripts/main.js
@@ -1,74 +1,73 @@
/*global ekwal:false */
-!function($) {
+;(function($) {
$(function() {
"use strict"; // Yes, that's half an ass, damnit JSHint(╯°□°)╯ ︵ ┻━┻
// Randomize the height/width of the elements we can test
var randomSize = function() {
- var tmp
- return (tmp = Math.floor(100 * Math.random())) > 10 ? tmp : 50
- }
- , $globalPlaceholders = $('.placeholder > li')
+ var tmp;
+ return (tmp = Math.floor(100 * Math.random())) > 10 ? tmp : 50;
+ },
+ $globalPlaceholders = $('.placeholder > li');
$globalPlaceholders.each(function() {
- var tmp
+ var tmp;
$(this).css({
- height: randomSize()
- , width : randomSize()
- })
- })
+ height: randomSize(),
+ width : randomSize()
+ });
+ });
// When the user test the plugin
$('form').on('submit', function(e) {
- e.preventDefault()
- var $form = $(this)
- , $input = $('input', $form)
+ e.preventDefault();
+ var $form = $(this),
+ $input = $('input', $form);
// Add a try catch to alert the exception if needed
try {
// Use the jQuery/Zepto plugin or the Vanilla one
if ($form.data('type') === 'jquery') {
- $('.placeholder > li', $form).ekwal($input.val())
- canIHazKittens && kittensAllTheWay()
+ $('.placeholder > li', $form).ekwal($input.val());
} else {
- ekwal($form[0].querySelectorAll('.placeholder > li'), $input.val())
- canIHazKittens && kittensAllTheWay()
+ ekwal($form[0].querySelectorAll('.placeholder > li'), $input.val());
}
+ canIHazKittens && kittensAllTheWay();
} catch(error) {
- alert(error.message + ' you silly boy.')
+ alert(error.message + ' you silly boy.');
}
- })
+ });
// Useless, as usual, I also was looking for cat sound but fuck it
var kittensAllTheWay = function() {
- $globalPlaceholders.each(function() {
- var $this = $(this)
- , kitty = 'http://placekitten.com'
- , width = $this.width()
- , height = $this.height()
- // Yay kittens \o/
- // Can i haz grey kittens?
- kitty += Math.random() > 0.5 ? '/' : '/g/'
- kitty += width + '/' + height
- $this.html($('<img>').attr({
- src: kitty
- , width: width
- , height: height
- }))
- })
- canIHazKittens = true
- }
- , canIHazKittens = false
- , kkeys = []
- , konami = '38,38,40,40,37,39,37,39,66,65'
+ $globalPlaceholders.each(function() {
+ var $this = $(this),
+ kitty = 'http://placekitten.com',
+ width = $this.width(),
+ height = $this.height();
+ // Yay kittens \o/
+ // Can i haz grey kittens?
+ kitty += Math.random() > 0.5 ? '/' : '/g/';
+ kitty += width + '/' + height;
+ $this.html($('<img>').attr({
+ src: kitty,
+ width: width,
+ height: height
+ }));
+ });
+ canIHazKittens = true;
+ },
+ canIHazKittens = false,
+ kkeys = [],
+ konami = '38,38,40,40,37,39,37,39,66,65';
$(document).on('keydown:kittens', function(e) {
- kkeys.push(e.keyCode)
+ kkeys.push(e.keyCode);
if (kkeys.toString().indexOf(konami) >= 0 ) {
- $(document).off('keydown:kittens')
- kittensAllTheWay()
+ $(document).off('keydown:kittens');
+ kittensAllTheWay();
}
- })
-})
+ });
+});
-}(window.jQuery || window.Zepto);
+}(window.jQuery || window.Zepto));
Something went wrong with that request. Please try again.