chown -R <user>:<group> <pathToFileOrDirectory> (-R to recursively change permission to a folder)
Nice blog explaining user management on Linux: https://www.linode.com/docs/tools-reference/linux-users-and-groups
chown -R <user>:<group> <pathToFileOrDirectory> (-R to recursively change permission to a folder)
Nice blog explaining user management on Linux: https://www.linode.com/docs/tools-reference/linux-users-and-groups
| let img = new Image(); | |
| img.onload = () => { | |
| console.log('youpiiii img preloaded !') | |
| }; | |
| img.src = 'some_url'; |
| import { modulo } from "./utils"; | |
| export class Pager { | |
| next:number = 0; | |
| previous:number = 0; | |
| constructor(public current:number = 0, public length:number = 0, noModulo:boolean = false) { | |
| this.setNeighbours(noModulo); | |
| } |
| img[alt] { | |
| position: relative; | |
| &:after { | |
| display: block; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| /* Add bg color and the text of the alt attribute in place of the broken image */ |
To completely uninstall node + npm is to do the following:
/usr/local/lib and delete any node and `node_modules/usr/local/include and delete any node and node_modules directorybrew install node, then run brew uninstall node in your terminallocal or lib or include folders, and delete any node or node_modules from there/usr/local/bin and delete any node executablesudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules| # Advanced Aliases. | |
| alias c='clear' | |
| # ls, the common ones I use a lot shortened for rapid fire usage | |
| alias l='ls -lFh' #size,show type,human readable | |
| alias la='ls -lAFh' #long list,show almost all,show type,human readable | |
| alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable | |
| alias lt='ls -ltFh' #long list,sorted by date,show type,human readable | |
| alias ldot='ls -ld .*' |
| // Does not handle hidden files like .htaccess the way you would want though ;) | |
| getFileExtension (filename) { | |
| let res = filename.substr(filename.lastIndexOf('.')+1); | |
| return res === filename ? '' : res; | |
| } |
| function query(selector, context) { | |
| context = context || document; | |
| // Redirect simple selectors to the more performant function | |
| if (/^(#?[\w-]+|\.[\w-.]+)$/.test(selector)) { | |
| switch (selector.charAt(0)) { | |
| case '#': | |
| // Handle ID-based selectors | |
| return [context.getElementById(selector.substr(1))]; | |
| case '.': | |
| // Handle class-based selectors |
| // The following code is all pseudo-code | |
| let elem = ...; // get element we want to fix | |
| let initScrollPosition = ...; // get initial position of element | |
| // the following pseudo-code should be is in a scrolling listener | |
| if (window.scrollYLevel > initScrollPosition) { | |
| elem.css.position = 'fixed'; | |
| elem.css.top = 0; // 0 or other position we'd want | |
| } else { |
| /* | |
| * @param property string, number or function. This is the crieteria of the grouping function | |
| */ | |
| function groupBy(arr, property) { | |
| return arr.reduce( (memo, el, i) => { | |
| let grpProperty = (() => { | |
| if (typeof property === 'string' || typeof property === 'number') { | |
| return el[property]; | |
| } else if (typeof property === 'function') { | |
| return property(el, i, arr); |