Gulp run deprecated

Since the latest version of gulp which no longer need to user the run() function for the logic, It make sense for me since the task function already take care of running the process.

First create a task like below example that compile coffeescript and minify it into javascript.

  var gulp = require('gulp'),
    coffee = require('gulp-coffee'),
    uglify = require('gulp-uglify');
  

  // define your file directory

  paths = {
    coffee: "./coffee/*.coffee"
    js:"./js"
  }


  // create an new task do compile coffeeScript
  gulp.task('coffeeScript', function(){
    gulp.src(paths.coffee)
    .pipe(coffee({bare:ture})) // options are allow here for coffee script
    .pipe(uglify()) // minify the javascript
    .pipe(gulp.dest(paths.js))
  });
  
  // watch the file changes...
  gulp.task('watch', function(){
      gulp.watch(paths.coffee, ['coffeeScript']);
  });
  
  // Gulp default function for proceed the gulp.
  gulp.task('default', ['coffeeScript', 'watch']);

anyway remember to update your node.js or else you will get an Bus Error.

Things I learn from developing phonegap app

While working with phonegap to build native apps I learn a lot. As you know phonegap or any other tools that used to develop apps with html5 always have bad performance. Here we tips that I learn which can be helpful.
I love jquery and use a lot, for web or any other things, mostly animations, interactions and DOM manipulating. But phonegap jquery animation looks really bad, so first rule for me is never use jquery animation on phonegap, use CSS animations. However that’s not the end, use translate instead of using positions:

transform:translate(100px, 100px);

Or

transform:translate3d(100px, 100px, 0);

jQuery click event comes with 300ms Delay, which made the app looks a bit unnatural, one javascript plugin I recommend is fastclick.js

FastClick.attach(document.body);

or if you prefer not to use plugin, touchend event should be good enough to prevent this delay.

$('element').on('touchend', function(){
// do something
})

… to be continue

Use variables instead of calling the DOM itself,

var someThing = $('.something');
someThing.attr('id', 'someId');
someThing.hide() // show()

Use touch when you want to overflow something within a box.

-webkit-overflow-scrolling:touch;

you can also style the sidebar using webkit sidebar:
[cc lang=’css’]
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: none;
padding:2px;
}

::-webkit-scrollbar-thumb {
border-radius: 6px;
background: #ccc;
}

Reduce the DOM elements, One way that I did is to create a Class in javascript, whenever a new Page need, call that function with that would append my Html into the Dom and remove the previous elements.

If you have more to share, please comment below…

Gulp Mamp development

I am doing quite a lot of wordpress stuff and since using Gulp, i found happiness in my development environment, here are the most common modules that I used.

  • tiny-lr
  • gulp-coffee
  • gulp-sass
  • gulp-uglify
  • gulp-jshint
  • gulp-util
  • gulp-livereload
  • gulp-imagemin

So what I want to do with my wordpress development is that every time I made some changes to SASS / CoffeeScript or even when I saved the image it will reload the page automatically.

Continue reading “Gulp Mamp development”

Ghost clean flat theme

Hi Guys,

as promised, i have developed the ghost theme, you can make a clone from

https://github.com/maxlibin/gohst-max

its free anyway!

Here is a screenshot of how actual look

To intall ghost theme, create a folder, name it anything you want, clone this repo to your folder.

copy the folder to your ghost theme folder,

Ghost->content->themes->place here…

Gulp js streaming build system

well if you are familiar with Grunt, this is another alternative task build tool Gulp, which is easier and flexible than Grunt

npm install -g gulp

If you are not familiar with Grunt or Gulp which both are tools that help you improve your workflow such as automated your script compiling, lint, minify it and output into another folder, every time you made an change. Its awesome tool that was built.

It just happened that I was reading some news and got into this Gulp thing and start exploring it, and found that its awesome and much easier to use than Grunt.

both are built in node, so you need to install the node module when you start an project,

at the root of your project folder, enter this in your terminal

npm install gulp —save

this will install, and now you can start creating a node script file, gulpfile.js

gulp use each plugin for each different task and thats a great concept, there are only 5 functions that you need know,

gulp.task // create a new task or action 

gulp.src // the source of this file start with same folder as gulpfile.js

gulp.run // run the task / action

gulp.watch // watch this folder or file if made some changes

gulp.dest // the destination of folder to output

Below is an example of how Gulp file work using gulp-sass plugin which will compile scss to css, if you are interested to read more, I suggest that you go directly to the gulp github repo. By the way when I install gulp using older version of Node.js I faced some problem watching the file, so you might want to update your node.js.

var sass = require(‘gulp-sass’);
var gulp = require(‘gulp’);
gulp.task(‘dosass’,function(){
gulp.src(‘sass/*.scss’).pipe(sass()).pipe(gulp.dest(‘./sass/css’));
})
gulp.task(‘default’, function() {
  gulp.run(‘dosass’);
  gulp.watch(‘sass/*.scss’, function(event){
    gulp.run(‘dosass’);
  })
})

Css filter

Recently I have been using the new CSS element called Filter alot, Its beautiful and easy to use, too bad not all browser are supporting it, infect what i know is for now is only -webkit- browser

Here are some properties that we could use:

  • blur
  • grayscale
  • drop-shadow
  • sepia
  • brightness
  • contrast
  • hue-rotate
  • invert
  • saturate
  • opacity

If you intend to try out now, just do -webkit-filter: blur(10px); // or other properties

By mixing with some of the properties you can get great effects like those Instagram right on your browser, only with CSS, thats really simple and awesome for me.

here is a link to the playground, check it out.

css filter playground

front-end development 2013

So, 2013 is going to end soon, 2013 is a year of major change of my front-end development process / work flow, below are list of tools that I can’t work without it.

Text Editor

  • Sublime Text
  • VIM

Compilers

  • SASS (css compiler)
  • Bourbon (sass mixins)
  • CoffeeScript (javascript compiler)

Version Control

 

  • Git
  • Bitbucket
  • SourceTree

 

Unities

  • Iterm 2
  • YeoMan
  • Codekit / Koala
  • NPM

Frameworks 

  • jQuery
  • Twitter Bootstrap
  • HTML5 Boilerplate
Its important that I made these changes, it helps me rapidly write codes and focus on enhancement rather than slicing the site from the PSD…
SASS, which is the css compiler helps a lot on CSS development, useful features like curly braces, mixins, includes, and more…or if you have never heard of it you should check out this post. What I think it’s much much easier to write css now days, so get SASS or other CSS compiler like LESS, STYLUS… whichever you prefer, it’s the same concept.
With bourbon, writing CSS/SASS/SCSS is even more simpler, bourbon provide mixins that we front-end developer could easily include and it will automatic produce those prefix that is just awesome for your css development.
NPM (node package manager) is another great tool that helps a lot in web development, the community is big and strong. there are lots of module that we could use to rapid our process, like we could install YeoMan.

npm install – yo

Once installed you can see the cute YeoMan character, and if you need to start an application just start by typing yo and choose an option that you want to create, or you could do “yo someApplicationName” and Bammm! thats it.

YeoMan works very well with Grunt and Bower, but instead I prefer Codekit, its much easier to work with, because of the user friendly GUI, its just awesome. when you edit your css it will automatically update on the browser and change it without refresh, but it will also compress your files. I know it can be done by Grunt if you do not want to spend some cash on that, however I highly recommended this tool as for those are new developer or unfamiliar with Grunt.

web development has just got better and better, its so much easier than those old days, lots of tools, huge community. looking forward to 2014 and practice more to improve ourself, not just outside by inner self too.

Here is a screenshot of my workflow:

 

Generate md5hash in mac terminal

Most of the time you need to generate a md5hash password for your mysql or any other purpose, you go to some md5hash generator website, but thats just wasting of time, and thanks to openssl you can generate using your terminal

echo -n “string that you want to convert” | openssl md5