Skip to content

Instantly share code, notes, and snippets.

@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active July 19, 2024 04:54
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

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
@agmm
agmm / nextjs-file-upload-api.js
Created January 31, 2020 23:03
Simple Nextjs File Upload — Backend API
// Backend
import formidable from 'formidable';
export const config = {
api: {
bodyParser: false,
},
};
export default async (req, res) => {
@oliveratgithub
oliveratgithub / readme.md
Created January 4, 2019 08:44
Configure the PHP CLI in macOS to use MAMP PHP binaries

Pre-requisites

Find MAMP's installed PHP version(s) you want to use the PHP CLI for:

$ ls -l /Applications/MAMP/bin/php/

Configure PHP CLI in macOS to use MAMP's PHP

  1. First, open your local user's .bash_profile in edit mode, in order to add aliases for accessing the PHP CLI locally
$ pico ~/.bash_profile
@sem1h
sem1h / Quaternion vs Euler Angles in Unity [TR].md
Last active June 19, 2024 10:40
Quaternion vs Euler Angles in Unity (Turkish)

Unity'de 3D çalışırken kafa kurcalayan konulardan biri Quaternion'ların ne işe yaradığı ve neden bazı yerlerde rotasyon değeri olarak Euler Angle değil de Quaternion kullanıldığıdır.

3 Boyutlu rotasyon belirtmek için kullanılan Euler Açısı, bir 3x3 rotasyon matrisi ile ifade edilebiliyor. Örnek:

Euler Açısı

İdeal bir sistemde her bir rotasyon matrisinin, yalnızca tek açıya isabet etmesini isteriz. Sorun şu ki bu matrisler, her zaman için tek açıya tekabül etmeyebiliyor.

@aluksidadi
aluksidadi / immutable-js-using-es6-cheatsheet.md
Last active February 19, 2024 16:05
Immutable javascript using es6 cheatsheet

Object

Merge object / Object assign / Object extend

const obj1 = {a: 1, b: 2, c: 3};
const obj2 = {c: 4, d: 5};

const obj3 = {
  ...obj1,
  ...obj2,
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@stereokai
stereokai / gist:36dc0095b9d24ce93b045e2ddc60d7a0
Last active July 10, 2024 00:23
CSS rounded corners with gradient border
.rounded-corners-gradient-borders {
width: 300px;
height: 80px;
border: double 4px transparent;
border-radius: 80px;
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff);
background-origin: border-box;
background-clip: padding-box, border-box;
}
@gokulkrishh
gokulkrishh / media-query.css
Last active July 16, 2024 10:52
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */