If you're deploying your app to somewhere where you can't be sure to have reliable disk read/write access, the normal strategy of writing to a temp-file doesn't work.
Instead we can open a pipe to the Phantom.js process, and then pass in the HTML via stdin
, and then have the rasterize.js
script write out the resulting PDF to stdout
, which we can then capture.
Any log messages from the Phantom.js process can be passed via stderr
if we want.
#!/bin/bash | |
# download and install latest chromedriver for linux or mac. | |
# required for selenium to drive a Chrome browser. | |
install_dir="/usr/local/bin" | |
version=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE) | |
if [[ $(uname) == "Darwin" ]]; then | |
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_mac64.zip | |
elif [[ $(uname) == "Linux" ]]; then | |
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_linux64.zip |
#!/bin/bash | |
# download and install latest geckodriver for linux or mac. | |
# required for selenium to drive a firefox browser. | |
install_dir="/usr/local/bin" | |
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest) | |
if [[ $(uname) == "Darwin" ]]; then | |
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))') | |
elif [[ $(uname) == "Linux" ]]; then | |
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))') |
Policies are additive. Anything you might do with policies, you could just implement in your custom actions directly. But they can make your life a lot easier.
Policies can be used like middleware, meaning you can do almost anything you can imagine with them. That said, our experience using Sails to build all sorts of different apps has taught us that policies are best used for one, very specific purpose: preventing access to actions for certain users (or types of users) where those actions are not accessible in the UI. That is, policies are best used like preconditions-- you can use them to take care of edge cases that are only possible by cheating the UI.
For example, imagine you're building an action called changePassword
in your UserController
. Its job is to take the new password that was provided, encrypt it, then update the database record for the currently-logged-in user to save the new encryped password. When you implement and test
First, Create a folder inside of lib
called seeds
Put your CSV file example.csv
into the lib/seeds
folder. In the example below, the file is called real_estate_transactions.csv
Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.
- http://ponyfoo.com/
- http://www.2ality.com/ (acá aprendí ECMAScript 6)
- http://addyosmani.com/blog
- http://rmurphey.com/
- https://alexsexton.com/
- http://carlosazaustre.es/blog/
- http://christianheilmann.com/
- http://dailyjs.com/ (este junta articulos muy buenos de otros blogs, muy bueno para conocer más blogs de a poco)
- http://davidwalsh.name/
- http://ariya.ofilabs.com/
var gulp = require('gulp'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babel = require('babelify'); | |
function compile(watch) { | |
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
/*! | |
* $rootScope listeners, remember to unbind on $destroy | |
*/ | |
var $rootListeners = { | |
'transmitProgress': $rootScope.$on('transmit:progress', transmitProgress), | |
'transmitSuccess': $rootScope.$on('transmit:success', transmitSuccess), | |
'transmitError': $rootScope.$on('transmit:error', transmitError) | |
}; | |
// iterate the Object and pass the methods to be called on $destroy |