For installing it:
npm i -g source-map-explorer
And for using it while developing your apps:
source-map-explorer .meteor/local/build/programs/web.browser/app/app.js{,.map}
Thanks to "Totally tooling tips":
npm i -g source-map-explorer
source-map-explorer .meteor/local/build/programs/web.browser/app/app.js{,.map}
/Library/LaunchDaemons/limit.maxfiles.plist with the following content and reboot:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>524288</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
$ ulimit -n 524288
top is generally a nice utility for that kind of tasks. But, there is a better and cleaner alternative: htop. A comparison picture is worth a thousand words.brew install htop
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webp-quicklook suspicious-package
rm command, it simplifies it when you are removing a tree of files. Super nice.pretty function to prettify your JSON documents or collections within the Mongo's shell:
db.find({}).pretty()
Here's the difference with a simple example:~/.mongorc.js using this command:
echo "DBQuery.prototype._prettyShell = true" >> ~/.mongorc.js
Thanks to Lee Machin for this tip: https://coderwall.com/p/3vfw9a
npm -g install mongo-hackerNow, here is the same example with some nice hacking:
ssh-copy-id is a simple tool that send your public SSH key to a remote server. Installing it on OSX:
brew install ssh-copy-id
192.168.1.32:
ssh-copy-id root@192.168.1.32Note: If you have never generated your SSH key pair, simply issue the following command:
ssh-keygen -t rsa -C
brew install tigI've made a simple video of its basic usage:
tail replacement: colortail.brew install colortail
sudo apt-get install colortail
~/.bashrc or your ~/.zshrc, add a simple aliases:
alias tail='colortail -k ~/.colortail/conf.default '
~/.colortail dir where you can put your colored theme files:
mkdir ~/. colortail
~/.colortail/conf.default file:
COLOR brightred
{
# matches the word ERROR
^.*(ERROR|error).*$
}
COLOR yellow
{
# matches the word WARNING
^.*(WARNING|warning).*$
}
COLOR green
{
# matches the word INFO
^.*(INFO|info).*$
}
COLOR grey
{
# matches the word DEBUG
^.*(DEBUG|debug).*$
}
COLOR brightblue
{
# matches the time
^.*([0-9]{2}:[0-9]{2}:[0-9]{2}).*$
}
vagrant ssh sudo salt-call state.highstate --log-level=debug
vagrant sshIt is now time to fill it with some goodies: NGINX with all the bells and whistles.
Vagrantfile where are stored your Saltstack files. Here, I put them in a directory named salt.
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Name of the node
config.vm.box = "UbuntuServer"
# Import a preinstalled Ubuntu Server 12.04 LTS
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-i386-vagrant-disk1.box"
# Add port forwarding to access service deployed in the node
config.vm.network "forwarded_port", host: 8080, guest: 80
# Synchronized folders
config.vm.synced_folder "salt/srv/salt/", "/srv/salt/"
# Use Saltstack as provisioner
config.vm.provision :salt do |salt|
# Set the directory where is stored your minion
salt.minion_config = "salt/minion"
# Maintain states
salt.run_highstate = true
end
end
Note the option salt.run_highstate = true. It tells Vagrant to ensure the node state whenever it is executing it.salt/minion file is kept as its bare minimum:
# We run in masterless mode master: localhost # We use the local file directory file_client: localWe use the default Saltstack directory structure to store our minion that will install NGINX:
.
├── Vagrantfile
└── salt
├── minion
└── srv
└── salt
├── top.sls
└── webserver.sls
The top.sls file is your entry file to the installation. Here, there is only one formula. Thus, it is pretty straightforward:base: '*': - webserverThe
webserver.sls is called by the top.sls. It contains the formula to install and run NGINX as a service:nginx: pkg: - installed service: - running - require: - pkg: nginx
vagrant destroy vagrant upNow, fire up your browser of choice and use the following URL:
http://localhost:8080. This should display the NGINX default page just as if you had install it on a regular Ubuntu server.vagrant provisionYou can install other services as easily. There are some already prepared formulas that you can directly import or take inspiration from in the Saltstack formulas repository.
brew tap josegonzalez/homebrew-php
brew install php54
brew tap homebrew/dupes
brew install josegonzalez/php/composer
brew install boris
boris as any of your regular commands like any regular REPL in your Terminal or iTerm2 or whatever CLI you like.sudo vim, you end up into the configuration of root. Therefore, you loose some of your personal plugins that requires local commands. That, and a warning message.sudo vim (providing a new $HOME via -H or using your /etc/sudoers), but still, there are situations when you have forgotten to use sudo and you end up stuck with a file that you can't overwrite.:w !sudo tee %
npm -g install coffee-script
Gulpfile.js that bootstraps Gulp into using CoffeeScript:require('coffee-script/register');
// This bootstraps your Gulp's main file
require('./Gulpfile.coffee');
Gulpfile.coffee and forget about most of the semicolon, accolades, parenthesis, ...package.json and automatically loads all the plugins in Gulp. Here are the steps to follow:package.json for your project:npm init
npm install --save-dev gulp-clean
Gulpfile.coffee, load Gulp and every plugins in two lines of code:gulp = require 'gulp' gp = do require 'gulp-load-plugins' # Load all gulp plugins
gp object. Their name matches the plugins name in camel case. Putting it more simply, for the plugin gulp-clean, you use it as gp.clean, for the plugin gulp-ruby-sass, you use is as gp.rubySass.gulp.task 'css', ->
gulp.src 'app/css/index.sass'
.pipe gp.watch()
.pipe gp.plumber() # Add Plumber just before the transpilation
.pipe gp.rubySass()
.pipe gulp.dest 'www/css'
Installing is made easy thanks to the automatic loading of plugins as described in the previous paragraph:npm install --save-dev gulp-plumber
path = require 'path' # Start a webserver for static files gulp.task 'webserver', gp.connect.server root: path.join __dirname, 'www' port: 9000 livereload: true open: browser: 'Google Chrome'Just like before, the installation is easy as pie:
npm install --save-dev gulp-connectNow, on each watch task requiring a livereload, just add a
gp.connect.reload() call to their task.# Create CSS from SASS
gulp.task 'css', ->
gulp.src 'app/css/index.sass'
.pipe gp.watch()
.pipe gp.plumber()
.pipe gp.rubySass()
.pipe gp.autoprefixer "> 1%" # Set Autoprefixer for 99%
.pipe gulp.dest 'www/css'
Gulpfile.coffee that I've used on a production website (a very basic SPA):
gulp = require 'gulp'
# Load all gulp plugins
gp = do require 'gulp-load-plugins'
path = require 'path'
# Start a webserver for static files
gulp.task 'webserver', gp.connect.server
root: path.join __dirname, 'www'
port: 9000
livereload: true
open: browser: 'Google Chrome'
# Create CSS from SASS
gulp.task 'css', ->
gulp.src 'app/css/index.sass'
.pipe gp.watch()
.pipe gp.plumber()
.pipe gp.rubySass()
.pipe gp.autoprefixer "> 1%"
.pipe gp.cssmin keepSpecialComments: 0
.pipe gulp.dest 'www/css'
.pipe gp.connect.reload()
# Create HTML from Jade
gulp.task 'html', ->
gulp.src 'app/index.jade'
.pipe gp.watch()
.pipe gp.plumber()
.pipe gp.jade()
.pipe gulp.dest 'www'
.pipe gp.connect.reload()
# Copy font files
gulp.task 'copy_fonts', ->
gulp.src './bower_components/font-awesome/fonts/*'
.pipe gulp.dest 'www/fonts'
# Copy vendor JS files, concatenate them and uglify them
gulp.task 'copy_js', ->
gulp.src [
'bower_components/better-dom/dist/better-dom.js'
'bower_components/better-details-polyfill/dist/better-details-polyfill.js']
.pipe gp.concat 'better-dom-and-plugin.js'
.pipe gp.uglify()
.pipe gulp.dest 'www/js'
# Copy vendor CSS files and minifies it
gulp.task 'copy_css', ->
gulp.src [
'bower_components/better-details-polyfill/dist/better-details-polyfill.css']
.pipe gp.cssmin keepSpecialComments: 0
.pipe gulp.dest 'www/css'
# Clean produced files
gulp.task 'clean', ->
gulp.src ['www', 'tmp']
.pipe gp.clean()
gulp.task 'default', [
'copy_fonts', 'copy_js', 'copy_css'
'css', 'html', 'webserver']
And here are the relevant part of its package.json:
{
"name": "Blablabla",
"version": "0.0.0",
"description": "",
"main": "Gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Me",
"license": "MIT",
"devDependencies": {
"gulp-cssmin": "~0.1.0",
"gulp-ruby-sass": "~0.3.0",
"gulp-util": "~2.2.14",
"gulp-autoprefixer": "0.0.6",
"gulp": "~3.5.2",
"gulp-jade": "~0.4.1",
"gulp-watch": "~0.5.0",
"gulp-sass": "~0.6.0",
"gulp-plumber": "~0.5.6",
"gulp-clean": "~0.2.4",
"gulp-load-plugins": "~0.3.0",
"gulp-concat": "~2.1.7",
"gulp-uglify": "~0.2.1",
"gulp-connect": "~0.3.1"
}
}
:r ! ls -l my_dir
:r ! tree -d
tree with Homebrew easily:brew install tree
Gulpfile.js. We will use this file to bootstrap CoffeeScript and, thus, regain access to a more friendly language. Of course, the same trick could be applied to other languages such as Dart or TypeScript.Gulpfile.js
// Note the new way of requesting CoffeeScript since 1.7.x
require('coffee-script/register');
// This bootstraps your Gulp's main file
require('./Gulpfile.coffee');
Gulpfile.coffee
# Load all required libraries.
gulp = require 'gulp'
sass = require 'gulp-ruby-sass'
prefix = require 'gulp-autoprefixer'
cssmin = require 'gulp-cssmin'
jade = require 'gulp-jade'
minifyHTML = require 'gulp-minify-html'
svgmin = require 'gulp-svgmin'
# Create your CSS from Sass, Autoprexif it to target 99%
# of web browsers, minifies it.
gulp.task 'css', ->
gulp.src 'app/css/index.sass'
.pipe sass()
.pipe prefix "> 1%"
.pipe cssmin keepSpecialComments: 0
.pipe gulp.dest 'www/css'
# Create you HTML from Jade, Adds an additional step of
# minification for filters (like markdown) that are not
# minified by Jade.
gulp.task 'html', ->
gulp.src 'app/index.jade'
.pipe jade()
.pipe minifyHTML()
.pipe gulp.dest 'www'
# Minify your SVG.
gulp.task 'svg', ->
gulp.src 'app/img/*.svg'
.pipe svgmin()
.pipe gulp.dest 'www/img'
# Copy the fonts using streams.
gulp.task 'copy', ->
gulp.src 'app/fonts/*'
.pipe gulp.dest 'www/fonts'
# Default task call every tasks created so far.
gulp.task 'default', ['css', 'html', 'svg', 'copy']