博文

目前显示的是 2016的博文

What is a good Git workflow?

From : https://help.github.com/articles/what-is-a-good-git-workflow/ We have a visual tutorial on the GitHub Workflow . It's a great way to learn about and understand our concept of good Git workflows. If you're the reading type, you can also read Scott Chacon's great article on the GitHub flow . Finally, if you're the sort of person who likes the web interface, we have a fantastic article on the GitHub flow in the browser . https://guides.github.com/introduction/flow/

resolve of angularJS

1 a resove. $routeProvider . when ( '/users' , { templateUrl: '...' , controller: 'UserListController' , resolve: { users: function(User) { return User.getAll(); } } }); app.controller( 'UserListController' , function (users) { $scope .users = users; });   2. $q.all $routeProvider . when ( '/users' , { templateUrl: '...' , controller: 'UserListController' , resolve: { data: function(User, Post, $q ) { deferred = $q .defer(); $q .all([User.getAll, Post.getTops()]).then(function(results) { deferred.resolve({ users: results[ 0 ], posts: results[ 1 ] }) }); return deferred.promise; } } });   ref: boiajs . c om/ 2015/ 08/ 27/ angular-route-use-resolve

console api of chrome

console.assert(expression, object) console.clear() console.count(label) console.debug(object [, object, …]) console.dir(object) console.dirxml(object) console.error(object [, object, …]) console.group(object[, object, …]) console.groupCollapsed(object[, object, …]) console.groupEnd() console.info(object) console.profile([label])   console .profileEnd(); console.time(label1)  --  console.timeEnd(label1) console.timeStamp([label]) console.warn(object [, object, …]) console.trace(object)  console.log("$s,$i,%d,$f,%o,%O,%c","s","1","2","2334.24","<html>DOM","jsObject","css") debugger ref: boiajs . c o m/ 201 5 /12/01 /chrome-debug-skill -console-api

node-async

install Async   bower install async --save npm install async --save jam install async spm install async component install caolan/async   .waterfall async.waterfall([ function (callback) { getUserById(userId, function (user) { callback ( null , user); }); }, function (user, callback) { getDepartmentByUser(user.id, function (department) { callback ( null , department); }); }, function (department, callback) { getUserById(department.id, function (users) { console.log(users) callback ( null ); }); } ])   parallel async.parallel([ function (callback) { getUsers( function (users) { callback ( null , users); }); }, function (callback) { getDepartments( function (departments) { callback ( null , departments); }); }, function (callback) { getTasks( function (tasks) { callback ( null , tasks); }); } ], function (err, results) { console.log(results); /

How to create a custom input validator with AngularJS

http://angularjs.io/how-to-create-a-custom-input-validator-with-angularjs/

Style Guide of angular 2

https://angular.io/docs/ts/latest/guide/style-guide.html https://angular.cn/docs/ts/latest/guide/style-guide.html https://github.com/johnpapa/angular-styleguide

Victory won't come to me unless I go to it.

Victory won't come to me unless I go to it. The distance between your dreams and reality is called action. There are only two creature who can surmount the pyramids--the eagle and the snail. It's never too late to do the right thing. We must face tomorrow, whatever it may hold, with determination, joy, and bravery. Life is a roller coaster. You can scream every time you hit a bump, or you can throw your hands up and enjoy the ride. Death is so final, whereas life is so full of possibilities. For some men, nothing is written unless they write it. Progress is impossible without change, and those who cannot change their minds cannot change anything. Victory won't come to me unless I go to it.

7 Top JavaScript Frameworks List in 2016

7 Top JavaScript Frameworks List in 2016 https://dzone.com/articles/top-javascript-frameworks-list-in-2016

ngAnimate of angularJS

A demo, reference https://docs.angularjs.org/api/ngAnimate <!doctype html> <html> <head> <script type="text/javascript" src="https://code.angularjs.org/1.5.8/angular.min.js"></script> <script type="text/javascript" src="https://code.angularjs.org/1.5.8/angular-animate.js"></script>   <style>   /*ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-animate.js*/  .summary{width:160px;height:160px;background:#f60;}  .fade{transition: 1s linear all;}  .fade.ng-enter{opacity:0;} /*transition-delay:0.3s;transition-duration:0s;*/  .fade.ng-enter.ng-enter-active{opacity:1;}/* The finishing CSS styles for the enter animation */  .fade.ng-leave{opacity:1;}  .fade.ng-leave.ng-leave-active{opacity:0;}  </style> </head> <script> (function(angular) { // load the module in your application by adding it as a dependent module: angular.module('test', ['ngAnimate'

spin.js UI Component

http://spin.js.org/#v2.3.2 /** * Copyright (c) 2011-2014 Felix Gnass * Licensed under the MIT license * http://spin.js.org/ * * Example: var opts = { lines: 12 // The number of lines to draw , length: 7 // The length of each line , width: 5 // The line thickness , radius: 10 // The radius of the inner circle , scale: 1.0 // Scales overall size of the spinner , corners: 1 // Roundness (0..1) , color: '#000' // #rgb or #rrggbb , opacity: 1/4 // Opacity of the lines , rotate: 0 // Rotation offset , direction: 1 // 1: clockwise, -1: counterclockwise , speed: 1 // Rounds per second , trail: 100 // Afterglow percentage , fps: 20 // Frames per second when using setTimeout() , zIndex: 2e9 // Use a high z-index by default , className: 'spinner' // CSS cl

QR Code multi-format 1D/2D barcode

图片
1.QR code free zxing library: https://github.com/zxing/zxing How to create QRcode: http://www.swetake.com/qrcode/index-e.html Open Source QR Code Library: https://osdn.jp/projects/qrcode jquery.qrcode.js: https://github.com/jeromeetienne/jquery-qrcode 2.PDF417 no utf-16 3.DM no free https://en.wikipedia.org/wiki/VCard /* utf.js - UTF-8 <=> UTF-16 convertion * * Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp> * Version: 1.0 * LastModified: Dec 25 1999 * This library is free. You can redistribute it and/or modify it. */ /* * Interfaces: * utf8 = utf16to8(utf16); * utf16 = utf16to8(utf8); */ function utf16to8(str) { var out, i, len, c; out = ""; len = str.length; for(i = 0; i < len; i++) { c = str.charCodeAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { out += str.charAt(i); } else if (c > 0x07FF) { out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); out += String.fromCharC

Rime Input Method Engine - http://rime.im/ 佛振

佛振 https://gratipay.com/~lotem/ http://rime.im/ https://github.com/rime/librime https://www.v2ex.com/t/140616  

Interceptors in AngularJS

http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/ https://github.com/johnpapa/angular-styleguide/blob/master/a1/i18n/zh-CN.md

Use HTML5 to resize an image before upload

From: http://stackoverflow.com/questions/23945494/use-html5-to-resize-an-image-before-upload https://github.com/rossturner/HTML5-ImageUploader <input name = "imagefile[]" type = "file" id = "takePictureField" accept = "image/*" onchange = " uploadPhotos ( \' #{ imageUploadUrl } \' ) " /> <form id = "uploadImageForm" enctype = "multipart/form-data" > <input id = "name" value = "#{name}" /> ... a few more inputs ... </form>   window . uploadPhotos = function ( url ){ // Read in file var file = event . target . files [ 0 ]; // Ensure it's an image if ( file . type . match ( /image.*/ )) { console . log ( 'An image has been loaded' ); // Load the image var reader = new FileReader (); reader . onload = function ( readerEvent ) { var image = new Image

the index position in the original array

1. Using map and indexOf method in an object array var  myArray=[{"id": 1 },{"id":2},{"id":3}]; var pos = myArray.map(function(e) { return e.id; }).indexOf( 1 );// pos === 0 var pos2 = myArray.indexOf({"id":1}); //pos2 always is -1 Ref: http://stackoverflow.com/questions/8668174/indexof-method-in-an-object-array 2. In AngularJS, Using $index OR indexOf( object ) 2.1 indexOf( object ) <div ng-repeat="object in objects">     {{objects.indexOf(person)}} </div> 2.2 using $index value for loops <div ng-repeat="object in objects | filter: {id:20}"> {{$index+1}} <div> Ref:  http://stackoverflow.com/questions/20756694/angularjs-find-the-index-position-of-filtered-value-in-the-original-array

A Practical Guide to AngularJS Directives

From:https://www.sitepoint.com/practical-guide-angularjs-directives-part-two/ Binding Between Isolated and Parent Scope Properties Often, it’s convenient to isolate a directive’s scope, especially if you are manipulating many scope models. But, you may also need to access some parent scope properties inside the directive in order for the code to work. The good news is that Angular gives you enough flexibility to selectively pass parent scope properties to the directive through bindings. Let’s revisit our hello world directive , which changes its background color automatically when somebody types a color name into the text field. Recall that we isolated the scope of the directive and the code stopped working? Well, let’s make it work now! Assume that the variable app is initialized and refers to the Angular module. The directive is shown below. app . directive ( 'helloWorld' , function ( ) { return { scope : { } , restrict : 'AE' , re