[ rails ] clear cache

Sometimes partial template got cache

Rails.cache.clear

ref : https://stackoverflow.com/questions/10443535/manually-clear-fragment-cache-in-rails

Advertisements

[ macOS, imagemagick ] gm identify: Unable to load module (“/usr/local/Cellar/graphicsmagick/1.3.25/lib/GraphicsMagick/modules-Q16/coders/jpeg.la: file not found”)

Problem

Error: Error: Command failed: gm identify: Unable to load module ("/usr/local/Cellar/graphicsmagick/1.3.25/lib/GraphicsMagick/modules-Q16/coders/jpeg.la: file not found") [No such file or directory].
gm identify: Request did not return an image.

Solution

$ brew install graphicsmagick
Error: graphicsmagick 1.3.25 is already installed
To upgrade to 1.3.26_1, run `brew upgrade graphicsmagick`
phongsathorneakamongul$ brew upgrade graphicsmagick

ref : https://stackoverflow.com/questions/22715738/imagemagick-error

[ icoMoon ] icon font .ttf .svg .woff .eot

Example here is using FontAwesome, however we can use icomoon to generate the font as well.

<html>
<head>
<style>
    @font-face {
        font-family: 'FontAwesome';
        src:url('http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/fonts/fontawesome-webfont.ttf') format('truetype'),
            url('http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/fonts/fontawesome-webfont.woff') format('woff'),
            url('http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/fonts/fontawesome-webfont.svg') format('svg');
     }

     .mail:before {
        font-family: FontAwesome;
        content: "\f095";
    }
</style>

</head>
<body>
    <i class="mail"></i>
</body>
</html>

 

[ npm ] install global permission error

problem

$ npm install -g bower
npm WARN deprecated bower@1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm ERR! tar.unpack untar error /home/pong/.npm/bower/1.8.2/package.tgz
npm ERR! Linux 4.10.0-19-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! node v4.8.4
npm ERR! npm v2.15.11
npm ERR! path /usr/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/bower'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/bower']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pong/npm-debug.log

recommended ​​​​​​Option 2: Change npm’s default directory to another directory

$ mkdir ~/.npm-global
$ npm config set prefix '~/.npm-global'

put this in ~/.profile

export PATH=~/.npm-global/bin:$PATH

then update your system variables

source ~/.profile

ref : https://docs.npmjs.com/getting-started/fixing-npm-permissions