This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # first argument - basename of files to be moved | |
| # second arguments - basename of destination files | |
| if [ $# -ne 2 ]; then | |
| echo "Two arguments required." | |
| exit; | |
| fi | |
| for i in $1.*; do | |
| if [ -e "$i" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Change global npm install dir to local user dir | |
| npm config set prefix ~/npm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var map = function(list, callback) { | |
| var arrList = []; | |
| if (!list) { | |
| throw new Error('Error, list is undefined'); | |
| } | |
| if (list.constructor === Array && list[0].constructor === Object) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _ = require 'lodash' | |
| data = [{ | |
| "id": 0, | |
| "guid": "b9425cd2-c93e-4cd3-ba98-bb31e792cdf5", | |
| "isActive": false, | |
| "balance": "$2,073.00", | |
| "picture": "http://placehold.it/32x32", | |
| "age": 29, | |
| "name": "Regina Emerson", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var aaa = [ | |
| {name: "AAA", id: 845}, | |
| {name: "BBB", id: 839}, | |
| {name: "CCC", id: 854} | |
| ]; | |
| var bbb = [ | |
| {id: 839}, | |
| {id: 854} | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function toObject(arr) { | |
| var rv = {}; | |
| for (var i = 0; i < arr.length; ++i) | |
| if (arr[i] !== undefined) rv[i] = arr[i]; | |
| return rv; | |
| } |