Skip to content

Instantly share code, notes, and snippets.

View darkmavis1980's full-sized avatar
🎯
Focusing

Alessio Michelini darkmavis1980

🎯
Focusing
View GitHub Profile
@darkmavis1980
darkmavis1980 / 0_reuse_code.js
Created November 7, 2013 17:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@darkmavis1980
darkmavis1980 / sass.console
Last active August 29, 2015 14:06
Watch and compress a file or a directory with SASS
//Just a file
sass --watch source.scss:dest.css --style compressed
//An entire directory
sass --watch app/sass:public/stylesheets --style compressed
@darkmavis1980
darkmavis1980 / nodejsupdate.txt
Last active August 29, 2015 14:06
Force NodeJS to update
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Thanks to David Walsh
http://davidwalsh.name/upgrade-nodejs
@darkmavis1980
darkmavis1980 / ssl_on_zpanel.txt
Last active July 31, 2017 19:19
SSL on ZPanel
Source from http://blog.arnas.web.id/?p=145 with edits
The following is an simplified how to install SSL Certificate on zPanel. You can use a self-signed SSL Certificate or buy.
First create ssl directory to easy maintain:
$ mkdir /var/zpanel/hostdata/zadmin/ssl
Then go to ssl directory:
@darkmavis1980
darkmavis1980 / jquery.each
Last active August 29, 2015 14:06
Example of the use of .each in jQuery
var $a = [1,2,3,4];
function parseNumber($data){
$.each($data,function(index, value){
console.log(index + ' ' +value);
});
}
parseNumber($a);
/* It will print:
@darkmavis1980
darkmavis1980 / VagrantWindows
Created September 29, 2014 15:59
Vagrant SSH on windows 8
if vagrant ssh doesn't want to work on windows, just type on the terminal
set PATH=%PATH%;C:\Program Files (x86)\Git\bin
and then "vagrant ssh"
@darkmavis1980
darkmavis1980 / linuxmount.MD
Last active August 29, 2015 14:07
How to automount partitions on linux

The first thing to do is to get the UUID of the hard drive, just type:

sudo blkid

This will return you a list of your hard drives with the UUID for each ones

/dev/sda1: UUID="206f61f1-a465-4240-935b-eea3c7c10cd9" TYPE="ext4" /dev/sda2: LABEL="Mimas" UUID="1569a3fe-65f0-4641-8eab-7c1f1affb5c2" TYPE="ext4" /dev/sda3: LABEL="Iapetus" UUID="d74de2c8-bc98-4032-8854-901d41f4b1b1" TYPE="ext4" /dev/sda5: UUID="7a375655-f71b-4686-8ac2-c0a260302165" TYPE="swap"

@darkmavis1980
darkmavis1980 / confirm_ngClick.txt
Last active August 29, 2015 14:09
Confirm before ng-Click
.directive('ngConfirmClick', [
function(){
return {
priority: -1,
restrict: 'A',
link: function(scope, element, attrs){
element.bind('click', function(e){
var message = attrs.ngConfirmClick;
if(message && !confirm(message)){
e.stopImmediatePropagation();
@darkmavis1980
darkmavis1980 / hextorgb.js
Last active April 4, 2018 08:48
HexToRGB in Javascript
// Converts any given HEX color to the relative RGB value
const HexToRGB = hex => hex.match(hex.length === 6 ? /.{2}/g : /.{1}/g).map(color => {
color = hex.length === 3 ? color + color : color;
return parseInt(color, 16);
});
console.log(HexToRGB('FFA955')); //[ 255, 169, 85 ]
console.log(HexToRGB('000000')); //[ 0, 0, 0 ]
console.log(HexToRGB('F00')); //[ 255, 0, 0 ]
@darkmavis1980
darkmavis1980 / squashgit
Last active November 28, 2018 14:36
Squash commits
// Squash the number of commits you want, 6 in this example
git reset --mixed HEAD~6
// Stage all the files
git add -A
// Commit the staged files
git commit -m "Your message"
// Then update the remote using --force
git push --force origin <YOUR-BRANCH-NAME>
// Or use rebase