Skip to content

Instantly share code, notes, and snippets.

View dashawk's full-sized avatar

Jason Panugaling dashawk

  • Cebu City, Philippines
View GitHub Profile
@dashawk
dashawk / math.js
Created July 26, 2017 08:38
Fun with Math
function round(number, decimalPlaces) {
return +(Math.round(number + 'e+' + decimalPlaces) + 'e-' + decimalPlaces);
}
@dashawk
dashawk / sample-nginx.conf
Created August 7, 2017 07:28 — forked from cjus/sample-nginx.conf
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
@dashawk
dashawk / guid-generator.js
Created October 18, 2017 01:11
Generate a GUID String
/**
* Generates a GUID string.
* @returns {String} The generated GUID.
* @example af8a8416-6e18-a307-bd9c-f2c947bbb3aa
* @author Slavik Meltser (slavik@meltser.info).
* @link http://slavik.meltser.info/?p=142
*/
function guid() {
function _p8(s) {
var p = (Math.random().toString(16)+"000000000").substr(2,8);
//region Get the Margin
var cost = 5;
var sell = 10;
var margin = 0;
// Original Formula
margin = ((sell - cost) / sell) * 100;
console.log('[Original]Margin', margin);
// Shorthand Formula
@dashawk
dashawk / gist:2b508f35f9820df0f6e312bcff8cb521
Created December 14, 2017 00:49 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@dashawk
dashawk / Laravel PHP7 LEMP AWS.md
Created January 26, 2018 04:15 — 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
@dashawk
dashawk / node-part-1.md
Last active February 9, 2018 06:55
Run NodeJS with Systemd Part 1
@dashawk
dashawk / node-part-2.md
Created February 9, 2018 06:54
Run NodeJs with Systemd Part 2
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");
var myPoints = [
[37.772,-122.214],
[21.291, -157.821],
[-18.142, 178.431],
[-27.467, 153.027]
]
@dashawk
dashawk / Configuration.h
Created July 18, 2018 13:48 — forked from istepanov/Configuration.h
Marlin Anet A8 config
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or