Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#resolving npm EACCES errors
#adjusts the user rights to the current user for the needed npm folders
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
@nicon-dev
nicon-dev / gist:fbccb383100ec8d8543c
Created August 21, 2014 11:52
SSH login without password
# First, on the local machine you will want to generate a secure SSH key:
ssh-keygen
# Walk through the key generator and set a password, the key file by default goes into ~/.ssh/id_rsa
# If you have named it differently, you have to add the private key manually:
ssh-add -K path/to/my_key
# Next, you need to copy the generated key to the remote server you want to setup passwordless logins with
@nicon-dev
nicon-dev / gist:239f1029f0b2b1fd026b
Created August 21, 2014 11:55
create SSH alias
nano ~/.bash_profile
alias servername='ssh -p 888 user@server.domain.com'
#Now you only have to type ‘servername’ and off you go.
#source: http://osxdaily.com/2011/04/11/use-aliases-to-create-ssh-shortcuts/
@nicon-dev
nicon-dev / js-obj-debug.js
Created November 3, 2014 11:38
JS: debug Object
for (i in arr) {
console.log(i);
console.log(arr[i]);
}
@nicon-dev
nicon-dev / revSlider-func.php
Created December 1, 2014 17:05
wordpress revolution slider php functions
$slider = new RevSlider();
$arrSliders = $slider->getArrSlidersShort(); // slider title
$my_slider_array = $slider->getAllSliderAliases(); // slider alias
@nicon-dev
nicon-dev / custom-menu.php
Created December 2, 2014 02:20
display custom WP menu
//first create menu in WP admin area
//then show menu by name
wp_nav_menu( array('menu' => 'menu-name' ));
@nicon-dev
nicon-dev / css-center.css
Last active June 12, 2016 13:55
CSS - centering techniques
/*1. center a div with margin: 0
- The element must display: block
- The element must not float
- The element must not have a fixed or absolute position
- The element must have a width that is not auto
2. Horizontal and vertical centering if the widths are dynamic:
*/
@nicon-dev
nicon-dev / wp-config.php
Created December 11, 2014 10:25
wp-config DEBUG settings #wordpress #debug
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
@nicon-dev
nicon-dev / show-mediasize.php
Created December 11, 2014 14:27
show image dimensions in wordpress media library #wordpress
//show image dimentions in media library
function wh_column( $cols ) {
$cols["dimensions"] = "Dimensions";
return $cols;
}
function wh_value( $column_name, $id ) {
$meta = wp_get_attachment_metadata($id);
if(isset($meta['width']))
echo ' ' . $meta['width'].' x '.$meta['height'] . 'px';
}
@nicon-dev
nicon-dev / cordova-commands.sh
Last active August 29, 2015 14:11
useful cordova/phonegap commands
#show corova/phonegap versions
npm info cordova version //show current version
npm info phonegap version
#show installed plugins
cordova plugin list
#add cordova plugins
cordova plugin add *gitrepo*
#example