Skip to content

Instantly share code, notes, and snippets.

Deployment steps:
git pull
cd smartschool
npm run-script build
cd ..
./gradlew bootRun
---------
Build and run jar:
./gradlew build
@Nata01
Nata01 / default
Last active March 29, 2018 00:09
Angular nginx minimal config
# File path: /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/ubuntu/ProjectBravo/smartschool/dist;
location /api {
proxy_redirect off;
proxy_pass http://localhost:8080;
git init
//create .gitignore
git remote add origin https://github.com/userName/projectName.git
git add .
git commit -m "Commit name"
git pull origin master
git push origin master
@Nata01
Nata01 / fibonacciRecursive.js
Last active December 17, 2015 17:32
Fibonacci Recursive
function fib(n){
if(n > 1){
return fib(n-1)+fib(n-2);
}
else if(n == 0){
return 0;
}
else if(n == 1){
return 1;
}
@Nata01
Nata01 / factorialLoop.js
Created December 17, 2015 17:00
Factorial using loop
function factorial(n){
var res = 1;
for(var i = 1; i <= n; i++){
res *= i;
}
return res;
}
@Nata01
Nata01 / factorialRecursive.js
Created December 17, 2015 16:55
Factorial recursive
function fact(n){
if(n != 1)
return fact(n-1)*n
else
return 1;
}
@Nata01
Nata01 / sumTo.js
Created December 17, 2015 16:40
Summarizing using the formula
function sumTo(n) {
return (1 + n) * n / 2;
}
@Nata01
Nata01 / sumTo.js
Created December 17, 2015 16:19
Summarizing using loop.
function sumTo(n){
rez = 0;
for(var i = 0; i <= n; i++){
rez += i;
}
return rez;
}
@Nata01
Nata01 / sumTo.js
Last active December 17, 2015 16:12
Summarizing recursive
function sumTo(n){
if(n != 1){
return n + sumTo(n-1);
}
else{
return 1;
}
}
@Nata01
Nata01 / insertElementIntoArray.java
Created December 17, 2015 14:06
Insertion of element into array
public static int[] insertElementIntoArray(int arr[], int position, int elem){
int[] tempArr = new int[arr.length+1];
for (int i = 0; i < position; i++) {
tempArr[i] = arr[i];
}
tempArr[position] = elem;
for (int i = position+1; i < tempArr.length; i++) {
tempArr[i] = arr[i-1];