Skip to content

Instantly share code, notes, and snippets.

@darwinsalinas
darwinsalinas / regex-camelCase-to-dash.js
Created January 12, 2017 17:14 — forked from youssman/regex-camelCase-to-dash.js
Javascript convert camelcase to dash (hyphen)
function camelCaseToDash( myStr ) {
return myStr.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
}
var myStr = camelCaseToDash( 'thisString' );
alert( myStr ); // => this-string
@darwinsalinas
darwinsalinas / autopgsqlbackup
Created April 7, 2017 02:45 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@darwinsalinas
darwinsalinas / Laravel PHP7 LEMP AWS.md
Created July 6, 2017 19:55 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip

Inspired and edited from this Digital Ocean tutorial.

Follow the steps on this gist to setup a LEMP stack with PHP 7.0.

The steps assume Nginx has been configured correctly.

Setup the root directories

For the domains example.com and test.com, create the folders.

atom-beautify@0.30.4
busy-signal@1.4.3
docblockr@0.11.0
emmet@2.4.3
file-icons@2.1.9
highlight-selected@0.13.1
hyperclick@0.1.2
intentions@1.1.2
language-blade@0.34.0
language-vue@0.23.0
"*":
core:
disabledPackages: [
"language-c"
"language-clojure"
"language-csharp"
"language-go"
"language-java"
"language-make"
"language-mustache"
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
@darwinsalinas
darwinsalinas / keymap.cson
Created July 26, 2017 15:54 — forked from rezapadillah/keymap.cson
Enable Emmet In laravel blade and vue language on atom
1. Go to keymap.cson on your atom editor
2. Copy and paste :
'atom-text-editor[data-grammar="text html php blade"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
'atom-text-editor[data-grammar~="vue"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
@darwinsalinas
darwinsalinas / keymap.cson
Created July 26, 2017 15:56
Enable tab completation Atom in blade an vue files
1. Go to keymap.cson on your atom editor
2. Copy and paste :
'atom-text-editor[data-grammar="text html php blade"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
'atom-text-editor[data-grammar~="vue"]:not([mini])':
@darwinsalinas
darwinsalinas / piecharts.js
Created June 1, 2018 16:07
Put custom label to pie chart
tooltips: {
callbacks: {
label: function (tooltipItem, data) {
let dataset = data.datasets[tooltipItem.datasetIndex]
let total = dataset.data.reduce(function (previousValue, currentValue, currentIndex, array) {
return previousValue + currentValue
})
let currentValue = dataset.data[tooltipItem.index]
let currentLabel = data.labels[tooltipItem.index]
let precentage = Math.floor(((currentValue / total) * 100) + 0.5)